SCREEN 800,600,0',0
'setwindow "Life",3
koko=60
Dim t(2,koko,koko)
tila=1
toinen=2
restart:
For x=1 to koko-1
For y=1 To koko-1
if rand(5)=1 then
t(tila,x,y)=1
t(toinen,x,y)=1
Else
t(tila,x,y)=0
t(toinen,x,y)=0
endif
Next y
Next x
Cls
k=0
repeat
k+1
v=(k/3 Shl 16) + (0 Shl 8) + 64+k/4'cos((k+25)/50.0)*64+64
for x=1 to koko-1
for y=1 to koko-1
a=0
a=a+t(tila,x-1,y)
a=a+t(tila,x+1,y)
a=a+t(tila,x,y-1)
a=a+t(tila,x,y+1)
a=a+t(tila,x-1,y-1)
a=a+t(tila,x+1,y+1)
a=a+t(tila,x+1,y-1)
a=a+t(tila,x-1,y+1)
't(toinen,x,y)=0
'if keydown(57) Then
if a=3 then
t(toinen,x,y)=1
ElseIf t(tila,x,y)=1 and a>1 And a<4 Then
t(toinen,x,y)=1
elseif a<2 or a>3 Then
t(toinen,x,y)=0
EndIf
'EndIf
'If t(toinen,x,y)=1 Then PutPixel x*8-rand(7),y*8-rand(7), 16777215
If t(tila,x,y)=1 Then PutPixel x*10-rand(9),y*10-Rand(9), v
Next y
next x
For x=1 to koko-1
For y=1 To koko-1
t(tila,x,y)=0
Next y
Next x
If k>512 then goto restart
'flip
kolmas=toinen
toinen=tila
tila=kolmas
DrawScreen OFF,OFF
forever