Advertisement
linesguy

Lo-res game of life (Updated)

Jan 3rd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. 0 rem Update mar 14: slight speed increase, and can change size of screen.
  2.  
  3. 5 height = 38 : rem max 38
  4. 6 width = 38 : rem max 38
  5.  
  6. 10 dim W(height*width) : gr : color = 15 : for r = 1 to 40 : ? : next
  7.  
  8. 50 for x = 1 to width : for y = 1 to height : if rnd(1)>0.5 then plot x,y
  9. 80 next : next
  10.  
  11. 100 Q = 0 : G = G + 1 : print "Generation: ";G
  12. 110 for x = 1 to width : for y = 1 to height : Q = Q + 1 : P = 0 : P = (scrn(X-1,y-1)/15)+(scrn(X ,y-1)/15)+(scrn(X+1,y-1)/15)+(scrn(X+1,y )/15)+(scrn(X+1,y+1)/15)+(scrn(X ,y+1)/15)+(scrn(X-1,y+1)/15) + (scrn(X-1,y)/15)
  13. 120 if P<2 or P>3 then W(Q) = 0 : next : next
  14. 130 if P = 2 then W(Q) = 2 : next : next
  15. 140 if P = 3 then W(Q) = 1 : next : next
  16.  
  17. 190 Q = 0
  18. 200 for x = 1 to width : for y = 1 to height : Q = Q + 1
  19. 210 if W(Q) = 0 then color = 0 : plot X,Y
  20. 220 if W(Q) = 1 then color = 15 : plot X,Y
  21. 230 next : next
  22. 240 color = 0 : hlin 0,39 at 0 : hlin 0,39 at 39 : vlin 0,39 at 0 : vlin 0,39 at 39
  23. 250 goto 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement