The Game of Life in Altair BASIC 27 May 2010 Tom Sanderson www.virtualaltair.com 5 XX=22:YY=20 10 DIMA(22,22),B(22,22) 20 L=100' 30 PRINT"ENTER INITIAL COORDINATES; 0,0 TO END." 40 ' 50 INPUTX,Y' 60 IFX+Y=0THENGOTO150 70 IF(X<1)OR(X>20)OR(Y<1)OR(X>20)THENPRINT"ERROR RE-ENTER":GOTO50 80 X=X+1:Y=Y+1 90 A(X,Y)=A(X,Y)+10 100 FORXW=X-1TOX+1:FORYW=Y-1TOY+1:A(XW,YW)=A(XW,YW)+1:NEXTYW:NEXTXW 130 GOTO50 140 ' 150 L$="+--------------------------------------------+" 160 P=22 170 FORI=1TOLSTEP2 180 ' 190 PRINTL$;I 200 FORY=1TOYY:PRINT"|";:FORX=1TOXX 210 IFA(X,Y)<10THENPRINT" ";ELSEPRINT"[]"; 220 B(X,Y)=0 230 NEXTX:PRINT"|":NEXTY 240 PRINTL$ 250 FORJ=25TOP:PRINT:NEXTJ 260 ' 270 FORX=2TOXX-1:FORY=2TOYY-1 280 AW=A(X,Y) 290 IF(AW<>3)AND(AW<>13)AND(AW<>14)THENGOTO340 300 B(X,Y)=B(X,Y)+10 310 FORXW=X-1TOX+1:FORYW=Y-1TOY+1 320 B(XW,YW)=B(XW,YW)+1 330 NEXTYW:NEXTXW 340 NEXTY:NEXTX 350 ' 360 PRINTL$;I+1 370 FORY=1TOYY:PRINT"|";:FORX=1TOXX 380 IFB(X,Y)<10THENPRINT" ";ELSEPRINT"[]"; 390 A(X,Y)=0 400 NEXTX:PRINT"|":NEXTY 410 PRINTL$ 420 FORJ=25TOP:PRINT:NEXTJ 430 ' 440 FORX=2TOXX-1:FORY=2TOYY-1 450 BW=B(X,Y) 460 IF(BW<>3)AND(BW<>13)AND(BY<>14)THENGOTO510 470 A(X,Y)=A(X,Y)+10 480 FORXW=X-1TOX+1:FORYW=Y-1TOY+1 490 A(XW,YW)=A(XW,YW)+1 500 NEXTYW:NEXTXW 510 NEXTY:NEXTX 520 NEXTI 530 ' 540 INPUT"ENTER NUMBER OF ADDITIONAL ITERATIONS";L 550 IFL>0THEGOTO150 560 END OK