	DIM A(11,11), B(11,11)
	Z=1
	INPUT "ENTER INITIAL NUMBER OF ITERATIONS";L
	RANDOMIZE
	INPUT "ENTER NUMBER OF CELLS TO FILL";F
	PRINT "NOW GENERATING RANDOM LIFEFORM. PLEASE STAND BY."

	IF F=0 THEN GOTO 20
	PRINT "FILLING ";F;" RANDOM CELLS"
	FOR Q=1 TO F
10		X=INT(RND*9)+1
		Y=INT(RND*9)+1
	IF (X<1) OR (Y>14) OR (Y<1) OR (X>14) THEN PRINT "ERROR RE-ENTER": GOTO 10
	X=X+1: Y=Y+1
	A(X,Y)=A(X,Y) + 10
	FOR XW=X-1 TO X+1: FOR YW=Y-1 TO Y+1
		A(XW,YW)=A(XW,YW)+1
		NEXT YW: NEXT XW

		NEXT Q
20	L$="+------------------------------------------------------------+"
	INPUT "ENTER PAPER SIZE (IN LINES/PAGE), SET UP PAPER & HIT ENTER";P
	FOR I=1 TO L STEP 2

		PRINT "GENERATION # ";Z
		FOR Y=1 TO 11: PRINT "~~:";: FOR X=1 TO 11
			IF A(X,Y)<10 THEN PRINT "  "; ELSE PRINT "[]";
			B(X,Y)=0
			NEXT X: PRINT ":": NEXT Y
		PRINT L$;
		Z=Z+1
		FOR X=2 TO 10: FOR Y=2 TO 10
			AW=A(X,Y)
			IF (AW>0) AND (AW<>3) AND (AW<>13) AND (AW<>14) THEN GOTO 30
			B(X,Y)=B(X,Y)+10
			FOR XW=X-1 TO X+1: FOR YW=Y-1 TO Y+1
				B(XW,YW)=B(XW,YW)+1
				NEXT YW: NEXT XW
	30			NEXT Y: NEXT X
		PRINT "GENERATION # ";Z
		FOR Y=1 TO 11: PRINT ":";: FOR X=1 TO 11
			IF B(X,Y)<10 THEN PRINT "  "; ELSE PRINT "[]";
			A(X,Y)=0
			NEXT X: PRINT ":": NEXT Y
		Z=Z+1
		FOR X=2 TO 10: FOR Y=2 TO 10
			BW=B(X,Y)
			IF (BW>0) AND (BW<>3) AND (BW<>13) AND (BW<>14) THEN GOTO 40
			A(X,Y)=A(X,Y)+10
			FOR XW=X-1 TO X+1: FOR YW=Y-1 TO Y+1
				A(XW,YW)=A(XW,YW)+1
				NEXT YW: NEXT XW
40	NEXT Y: NEXT X
	NEXT I

	INPUT "ENTER NUMBER OF ADDITIONAL ITERATIONS";L
	IF L>0 THEN GOTO 20
	STOP
	END
