10 cls:DEFINT A-Z:CLEAR 1000:L9=52:DIM S(L9+1,L9+1),M$(72)
20 Y=0:A=0:S=0:INPUT "DO YOU WANT INSTRUCTIONS";J$:  IF LEFT$(J$,1)="N" THEN 290
30 cls:print "THIS IS JOHN CONWAY'S GAME OF LIFE."
40 PRINT
50 PRINT"THE GAME INVOLVES CELLULAR GENERATION GROWTH. EACH CELL IS"
60 PRINT"ONE PRINTED CHARACTER. A CELL IS SURROUNDED BY EIGHT OTHER"
70 PRINT"CELLS, IN THREE DIRECTIONS: DIAGONALLY, HORIZONTALLY, AND"
80 PRINT"VERTICALLY. IN EACH GENERATION CELLS DIE AND GROW"
90 PRINT"SIMULTANEOUSLY."
100 PRINT
110 PRINT"A CELL DIES FROM OVERPOPULATION IF IT IS SURROUNDED BY MORE"
120 PRINT"THAN THREE LIVING CELLS. IT WILL ALSO DIE OF ISOLATION IF IT"
130 PRINT"HAS LESS THAN TWO CELLS SURROUNDING IT. NEW CELLS CAN BE"
140 PRINT"FORMED IN EMPTY POSITIONS ONLY; IF AND ONLY IF IT HAS THREE"
150 PRINT"CELLS AROUND IT.":PRINT:PRINT
160 INPUT "TO CONTINUE, TYPE RETURN";A$:cls
170 PRINT"YOU WILL BE ASKED TO ENTER THE FIRST, LAST, AND THE INTERVAL"
180 PRINT"BETWEEN THE GENERATIONS TO BE PRINTED."
190 PRINT
200 PRINT"ENTER YOUR PATTERN - A LINE AT A TIME - A '*' WHERE"
210 PRINT"YOU WANT A LIVE CELL AND A ' ' (SPACE) FOR AN EMPTY ONE."
220 PRINT"MAXIMUM BOARD SIZE IS 52 BY 52."
230 PRINT
240 PRINT"WHEN YOU'RE FINISHED, TYPE IN THE WORD 'DONE'"
250 PRINT"AS YOUR LAST LINE."
260 PRINT
270 PRINT"NOTE: IF THE LIMITS ARE REACHED, IT WILL TERMINATE."
280 PRINT:PRINT:INPUT "TO CONTINUE , TYPE RETURN";A$
290 cls
300 INPUT"WHICH GENERATION SHALL THE PRINTING START WITH";T
310 INPUT"AND THE LAST GENERATION";R1
320 INPUT"ALSO, HOW MANY SHALL I SKIP";O
330 O=O+1
340 PRINT "ENTER PATTERN:"
350 FOR M=1 TO L9
360 LINE INPUT M$
370 IF M$="DONE" THEN 480
380 IF LEN(M$)<L9+1 THEN 400
390 PRINT"NO MORE THAN "L9;" CELLS PER LINE":GOTO 360
400 FOR R=1 TO LEN(M$)
410 IF MID$(M$,R,1)=" " THEN 460
420 IF MID$(M$,R,1)<>"*" THEN 490
430 S(M,R)=1
440 A=A+1
450 IF R>S THEN S=R
460 NEXT R
470 NEXT M
480 GOTO 520
490 PRINT"'";MID$(M$,R,1);"' IS NEITHER A ' ' NOR A '*'";
500 PRINT"--TYPE THE LINE AGAIN":A=A-(R-1)
510 GOTO 360
520 DIM X(L9+1,L9+1)
530 IF Y<=0 THEN 550
540 GOTO 20
550 ERASE X
560 DIM X(L9+1,L9+1)
570 V=0:G=0
580 Y=M-1:N1=M-1
590 cls:print "GENERATION = 0 POPULATION =";A
600 GOSUB 1020
610 G=G+1
620 A=0:V=0
630 FOR M=1 TO N1
640 FOR R=1 TO S
650 J=0
660 IF M>L9 OR R>L9 THEN 1370
670 IF X(M,R+1)<=0 OR R=S THEN 690
680 J=J+1
690 IF X(M+1,R+1)<=0 OR M=N1 OR R=S THEN 710
700 J=J+1
710 IF X(M+1,R)<=0 OR M=N1 THEN 730
720 J=J+1
730 IF M=N1 OR R=1 THEN 760
740 IF X(M+1,R-1)<=0 THEN 760
750 J=J+1
760 IF R=1 THEN 790
770 IF X(M,R-1)<=0 THEN 790
780 J=J+1
790 IF M=1 OR R=1 THEN 820
800 IF X(M-1,R-1)<=0 THEN 820
810 J=J+1
820 IF M=1 THEN 850
830 IF X(M-1,R)<=0 THEN 850
840 J=J+1
850 IF M=1 OR R=S THEN 880
860 IF X(M-1,R+1)<=0 THEN 880
870 J=J+1
880 IF J=3 THEN 900
890 IF J<>2 OR X(M,R)<=0 THEN 920
900 S(M,R)=1
910 A=A+1
920 NEXT R
930 NEXT M
940 IF A=0 THEN 1340
950 IF G=R1 THEN 970
960 IF (G<T) OR (G-T)/O<>INT((G-T)/O) THEN 990
970 cls:print "GEN=";G;TAB(20);"POP=";A
980 GOTO 1000
990 V=9
1000 GOSUB 1020
1010 GOTO 610
1020 J=50:A=50
1030 C=0:D=0
1040 FOR M=1 TO N1
1050 FOR R=S TO 1 STEP -1
1060 IF S(M,R)<=0 THEN 1130
1070 IF M<J THEN J=M
1080 IF R<A THEN A=R
1090 IF M>C THEN C=M
1100 IF R>D THEN D=R
1110 IF V=9 THEN 1130
1120 PRINT TAB(R);CHR$(27)+"g"+CHR$(22)+CHR$(27)+"G"+CHR$(11)
1130 NEXT R
1140 IF V=9 THEN 1160
1150 PRINT
1160 NEXT M
1170 IF G=R1 THEN 1350
1180 C=C-J+3
1190 D=D-A+3
1200 X(1,5)=3
1210 ERASE X
1220 DIM X(L9+1,L9+1)
1230 FOR M=1 TO N1
1240 FOR R=1 TO S
1250 IF S(M,R)<=0 THEN 1270
1260 X(M-J+2,R-A+2)=1
1270 NEXT R
1280 NEXT M
1290 ERASE S
1300 DIM S(L9+1,L9+1)
1310 N1=C
1320 S=D
1330 RETURN
1340 PRINT "NO MORE LIFE IN GENERATION";G
1350 PRINT "*** END OF RUN ***"
1360 GOTO 1380
1370 PRINT "CELL HAS REACHED LIMITS OF PROGRAM. PROGRAM MUST TERMINATE."
1380 PRINT
1390 INPUT "ANOTHER RUN";J$
1400 Y=0:A=0:S=0
1410 ERASE S
1420 DIM S(L9+1,L9+1)
1430 IF LEFT$(J$,1)="Y" THEN CLEAR:L9=52:GOTO 290
1450 END
R RUN";J$
1400 Y=0:A=0:S=0
1410 ERASE S
1420 DIM S(L9+1,L9+1)
1430 IF LEFT$(J$,1)="Y" 