2 PRINT TAB ( 34 ) ; "LIFE" 
4 PRINT TAB ( 15 ) ; "CREATIVE COMPUTING  MORRISTOWN NEW JERSEY" 
6 PRINT : PRINT : PRINT 
8 PRINT "ENTER YOUR PATTERN, AS A SERIES OF SPACES" 
9 PRINT "AND STARS, LINE BY LINE. FINISH BY TYPING" 
10 PRINT "'DONE' ON THE FINAL LINE:" 
11 X1 = 1 : Y1 = 1 : X2 = 24 : Y2 = 70 : G = 0 : P = 0 
12 DIM A ( 24 , 70 ) : DIM B$ ( 24 ) 
15 I9 = 1 
20 C = 1 
30 INPUT TEMP$ 
35 B$ ( C ) = TEMP$ 
40 IF B$ ( C ) = "DONE" THEN 45 ELSE 50 
45 B$ ( C ) = "" : GOTO 80 
46 REM ORIGINAL VERSION REQUIRED USER TO WRITE 
47 REM DOTS INSTEAD OF SPACES, WHICH WOULD THEN BE 
48 REM CONVERTED TO SPACES 
50 REM IF LEFT$(B$(C), 1)="." THEN 55 ELSE 60 
55 REM B$(C)=" "+RIGHT$(B$(C), LEN(B$(C))-1) 
60 C = C + 1 
70 GOTO 30 
80 C = C - 1 : L = 0 
90 FOR X = 1 TO C - 1 
100 IF LEN ( B$ ( X ) ) > L THEN 105 ELSE 110 
105 L = LEN ( B$ ( X ) ) 
110 NEXT X 
120 X1 = INT ( 11 - C / 2 ) 
130 Y1 = INT ( 33 - L / 2 ) 
135 REM TRANSCRIBE INPUT PATTERN INTO ARRAY 
140 FOR X = 1 TO C 
150 FOR Y = 1 TO LEN ( B$ ( X ) ) 
160 IF MID$ ( B$ ( X ) , Y , 1 ) <> " " THEN 165 ELSE 170 
165 A ( X1 + X , Y1 + Y ) = 1 : P = P + 1 
170 NEXT Y 
180 NEXT X 
200 PRINT CHR$ ( 27 ) + "[2J" 
210 PRINT CHR$ ( 27 ) + "[2;1HGENERATION: " ; G ; " POPULATION: " ; P ; CHR$ ( 27 ) + "[K" ; 
212 IF I9 = 0 THEN 213 ELSE 215 
213 PRINT " INVALID!" ; CHR$ ( 27 ) + "[K" ; 
215 X3 = 24 : Y3 = 70 : X4 = 1 : Y4 = 1 : P = 0 
220 G = G + 1 
230 FOR X = X1 TO X2 
240 IF X-X1+1 < 17 THEN PRINT CHR$ ( 27 ) + "[K" 
250 FOR Y = Y1 TO Y2 
253 IF A ( X , Y ) = 2 THEN 254 ELSE 256 
254 A ( X , Y ) = 0 : GOTO 270 
256 IF A ( X , Y ) = 3 THEN 258 ELSE 260 
258 A ( X , Y ) = 1 : GOTO 261 
260 IF A ( X , Y ) <> 1 THEN 270 
261 IF X-X1+1 < 17 THEN PRINT TAB ( Y ) ; "*" ; 
262 IF X < X3 THEN 263 ELSE 264 
263 X3 = X 
264 IF X > X4 THEN 265 ELSE 266 
265 X4 = X 
266 IF Y < Y3 THEN 267 ELSE 268 
267 Y3 = Y 
268 IF Y > Y4 THEN 269 ELSE 270 
269 Y4 = Y 
270 NEXT Y 
290 NEXT X 
293 PRINT
295 FOR X = X2 + 1 TO 24 
296 IF X-X1+1 < 17 THEN PRINT " "*71
297 NEXT X 
299 X1 = X3 : X2 = X4 : Y1 = Y3 : Y2 = Y4 
301 IF X1 < 3 THEN 302 ELSE 303 
302 X1 = 3 : I9 = - 1 
303 IF X2 > 22 THEN 304 ELSE 305 
304 X2 = 22 : I9 = - 1 
305 IF Y1 < 3 THEN 306 ELSE 307 
306 Y1 = 3 : I9 = - 1 
307 IF Y2 > 68 THEN 308 ELSE 309 
308 Y2 = 68 : I9 = - 1 
309 P = 0 
500 FOR X = X1 - 1 TO X2 + 1 
510 FOR Y = Y1 - 1 TO Y2 + 1 
520 C = 0 
530 FOR I = X - 1 TO X + 1 
540 FOR J = Y - 1 TO Y + 1 
550 IF A ( I , J ) = 1 OR A ( I , J ) = 2 THEN 555 ELSE 560 
555 C = C + 1 
560 NEXT J 
570 NEXT I 
580 IF A ( X , Y ) = 0 THEN 610 
590 IF C < 3 OR C > 4 THEN 592 ELSE 595 
592 A ( X , Y ) = 2 : GOTO 600 
595 P = P + 1 
600 GOTO 620 
610 IF C = 3 THEN 615 ELSE 620 
615 A ( X , Y ) = 3 : P = P + 1 
620 NEXT Y 
630 NEXT X 
635 X1 = X1 - 1 : Y1 = Y1 - 1 : X2 = X2 + 1 : Y2 = Y2 + 1 
640 GOTO 210 
650 END 
