set display mode 640,480,32
sync on
sync rate 40
 
Dim cool(0):cool(0) = 5
Dim Life(0):Life(0) = 40
Dim Grid(130+cool(0),98+cool(0))
Dim Neighbors(8)
 
restore stuff
For I = 1 to 8
    Read Neighbors(I)
Next I
 
Do
 
  cls
 
  x = int(mousex()/5)
  y = int(mousey()/5)
 
  for yint=y-cool(0) to y+cool(0)
      for xint=x-cool(0) to x+cool(0)
          If rnd(5) > 3 then Grid(xint+cool(0),yint+cool(0)) = Life(0)
      next xint
  next yint
 
  For y = 1 to 96
      For x = 1 to 128
          If Grid(x,y) > 0 then box ((x-1)*5)+1,((y-1)*5)+1,x*5,y*5,rgb(x*2,0,y*2),rgb(x*2,0,y*2+2),rgb(x*2+2,0,y*2),rgb(x*2+2,0,y*2+2): Grid(x,y) = Grid(x,y) - 1
      Next x
  Next y
 
  text 5,5,str$(screen fps())
 
  sync
 
Loop
 
Stuff:
Data 0,0,2,1,0,0,0,0