Advertisement
linesguy

Rule 30 (1D cellular automata)

Mar 18th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. 0 rem 1D Cellular Automata (rule 30)
  2.  
  3. 10 hgr2 : hcolor = 3 : hplot 140,0
  4. 20 for Y = 0 to 140
  5. 30 for X = 1 to 278
  6. 40 gosub 1000
  7. 50 next
  8. 60 next
  9.  
  10.  
  11. 1000 if hscrn(x-1,y) = 3 and hscrn(X,Y) = 3 and hscrn(X+1,Y) = 3 then hcolor = 0 : hplot X,Y+1
  12. 1010 if hscrn(x-1,y) = 3 and hscrn(X,Y) = 3 and hscrn(X+1,Y) = 0 then hcolor = 0 : hplot X,Y+1
  13. 1020 if hscrn(x-1,y) = 3 and hscrn(X,Y) = 0 and hscrn(X+1,Y) = 3 then hcolor = 0 : hplot X,Y+1
  14. 1030 if hscrn(x-1,y) = 3 and hscrn(X,Y) = 0 and hscrn(X+1,Y) = 0 then hcolor = 3 : hplot X,Y+1
  15. 1040 if hscrn(x-1,y) = 0 and hscrn(X,Y) = 3 and hscrn(X+1,Y) = 3 then hcolor = 3 : hplot X,Y+1
  16. 1050 if hscrn(x-1,y) = 0 and hscrn(X,Y) = 3 and hscrn(X+1,Y) = 0 then hcolor = 3 : hplot X,Y+1
  17. 1060 if hscrn(x-1,y) = 0 and hscrn(X,Y) = 0 and hscrn(X+1,Y) = 3 then hcolor = 3 : hplot X,Y+1
  18. 1070 if hscrn(x-1,y) = 0 and hscrn(X,Y) = 0 and hscrn(X+1,Y) = 0 then hcolor = 0 : hplot X,Y+1
  19. 1080 return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement