! Life (goes on) ! Conway's Life in BASIC! ! mookiebearapps w=20:h=30 GOSUB start generate: LET k=CLOCK() FOR y=2 TO h-1 FOR x=2 TO w-1 LET l=x-1:LET r=x+1:LET u=y-1:LET d=y+1 LET t=a[l,u]+a[x,u]+a[r,u]+a[l,y]+a[r,y]+a[l,d]+a[x,d]+a[r,d]:LET n=(t=3)+(t=2)*a[x,y]:LET b[x,y]=n IF n<>a[x,y] THEN GR.MODIFY o[x,y],"paint",p1*n+p2*(1-n) NEXT NEXT GR.RENDER ARRAY.COPY b[],a[] e+=CLOCK()-k:g++ GOTO generate start: GR.OPEN 255,0,0,0,0,1 GR.SCREEN ww,hh qq=ww/w GR.SET.STROKE qq WAKELOCK 3 DIM a[w,h],b[w,h],o[w,h] ! init grid FOR y=1 TO h FOR x=1 TO w IF x>w/4 & x< w-w/4 & y>h/4 & y