Here's the resulting listing (I wrote it with CBM prg Studio):
Code: Select all
0 poke 36879,8:print"{clear}{green}";:gosub 63999:gosub 1:goto 5
1 for i=o to a:for j=o to b:g(i,j)=-((rnd(o)*x)<=e):next j,i:return
2 for i=z to h:for j=z to w:if g(i,j) then print c$;:goto 4
3 print s$;
4 next j,i:for i=o to a:for j=o to b:c=g(i,j):n=n+(c and g(i-o,j))+(c and g(i-o,j-o))+(c and g(i-o,j+o))+(c and g(i+o,j))+(c and g(i+o,j+o))+(c and g(i+o,j-o))+(c and g(i,j-o))+(c and g(i,j+o)):g(i,j)=-(n=d or n=e):n=z:next j,i
5 g=g+o:print t$g:get a$:on-(a$="")goto 2:print"{clear}":gosub 1:g=z:goto 5
63999 i=j=z:n=z:o=1:x=11:h=20:w=21:a=h-o:b=w-o:c=z:d=2:e=3:a$="":c$="0":s$=" ":t$="{home}generation:":dim g(h,w):return
Updates from one generation to the next is quite slow, even with the compiled version, but I expected this. If nothing else it was an interesting challenge to reduce the number of lines etc...
Regards,
Shaun.