Advertisement
linesguy

Mini next-nearest-neighbour-cellular-automata

Mar 30th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. 0 rem This program was derived from the next-nearest-neighbour-cellular-automata
  2.  
  3. 2 width = 10 : rem max 277
  4.  
  5. 5 BA = 0 : rem if 1, Then it will draw bars around each pattern, Apparently not needed for most patterns.
  6.  
  7. 10 hgr : onerr goto 9999
  8. 11 rule$ = "" : for x = 1 to 40 : print : next : print "Rule:" : for re = 1 to peek(78)+peek(78)+peek(78)+peek(78) : er = rnd(1) : next : for re = 1 to 32 : rule$ = rule$ + str$(int(rnd(1)*2)) : next
  9. 12 rem Rule$ = ""
  10. 13 print rule$ : for X = 2 to width : hcolor = int(rnd(1)*2)*3 : hplot X+x2,0 : next
  11. 16 hcolor = 3
  12. 17 if ba = 1 then hplot 0+x2,0 to 0+x2,100 : hplot 1+x2,0 to 1+x2,100
  13. 18 if ba = 1 then hplot width+1+x2,0 to width+1+x2,100 : hplot width+2+x2,0 to width+2+x2,100
  14. 20 for Y = 0 to 99
  15. 30 for X = 2+x2 to width+x2
  16.  
  17. 1000 if hscrn(X-2,Y) = 3 then goto 2000
  18. 1010 goto 2020
  19.  
  20. 2000 if hscrn(X-1,Y) = 3 then goto 3000
  21. 2010 goto 3020
  22. 2020 if hscrn(X-1,Y) = 3 then goto 3040
  23. 2030 goto 3060
  24.  
  25. 3000 if hscrn(X,Y) = 3 then goto 4000
  26. 3010 goto 4020
  27. 3020 if hscrn(x,y) = 3 then goto 4040
  28. 3030 goto 4060
  29. 3040 if hscrn(x,y) = 3 then goto 4080
  30. 3050 goto 4100
  31. 3060 if hscrn(x,y) = 3 then goto 4120
  32. 3070 goto 4140
  33.  
  34. 4000 if hscrn(X+1,Y) = 3 then goto 5000
  35. 4010 goto 5020
  36. 4020 if hscrn(X+1,Y) = 3 then goto 5040
  37. 4030 goto 5060
  38. 4040 if hscrn(x+1,y) = 3 then goto 5080
  39. 4050 goto 5100
  40. 4060 if hscrn(x+1,y) = 3 then goto 5120
  41. 4070 goto 5140
  42. 4080 if hscrn(x+1,y) = 3 then goto 5160
  43. 4090 goto 5180
  44. 4100 if hscrn(x+1,y) = 3 then goto 5200
  45. 4110 goto 5220
  46. 4120 if hscrn(x+1,y) = 3 then goto 5240
  47. 4130 goto 5260
  48. 4140 if hscrn(x+1,y) = 3 then goto 5280
  49. 4150 goto 5300
  50.  
  51. 5000 if hscrn(X+2,Y) = 3 then hcolor = val(mid$(rule$,1,1))*3 : hplot X,Y+1 : goto 6000
  52. 5010 hcolor = val(mid$(rule$,2,1))*3 : hplot X,Y+1 : goto 6000
  53. 5020 if hscrn(X+2,Y) = 3 then hcolor = val(mid$(rule$,3,1))*3 : hplot X,Y+1 : goto 6000
  54. 5030 hcolor = val(mid$(rule$,4,1))*3 : hplot X,Y+1 : goto 6000
  55. 5040 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,5,1))*3 : hplot x,y+1 : goto 6000
  56. 5050 hcolor = val(mid$(rule$,6,1))*3 : hplot X,Y+1 : goto 6000
  57. 5060 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,7,1))*3 : hplot x,y+1 : goto 6000
  58. 5070 hcolor = val(mid$(rule$,8,1))*3 : hplot X,Y+1 : goto 6000
  59. 5080 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,9,1))*3 : hplot x,y+1 : goto 6000
  60. 5090 hcolor = val(mid$(rule$,10,1))*3 : hplot X,Y+1 : goto 6000
  61. 5100 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,11,1))*3 : hplot x,y+1 : goto 6000
  62. 5110 hcolor = val(mid$(rule$,12,1))*3 : hplot X,Y+1 : goto 6000
  63. 5120 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,13,1))*3 : hplot x,y+1 : goto 6000
  64. 5130 hcolor = val(mid$(rule$,14,1))*3 : hplot X,Y+1 : goto 6000
  65. 5140 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,15,1))*3 : hplot x,y+1 : goto 6000
  66. 5150 hcolor = val(mid$(rule$,16,1))*3 : hplot X,Y+1 : goto 6000
  67. 5160 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,17,1))*3 : hplot x,y+1 : goto 6000
  68. 5170 hcolor = val(mid$(rule$,18,1))*3 : hplot X,Y+1 : goto 6000
  69. 5180 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,19,1))*3 : hplot x,y+1 : goto 6000
  70. 5190 hcolor = val(mid$(rule$,20,1))*3 : hplot X,Y+1 : goto 6000
  71. 5200 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,21,1))*3 : hplot x,y+1 : goto 6000
  72. 5210 hcolor = val(mid$(rule$,22,1))*3 : hplot X,Y+1 : goto 6000
  73. 5220 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,23,1))*3 : hplot x,y+1 : goto 6000
  74. 5230 hcolor = val(mid$(rule$,24,1))*3 : hplot X,Y+1 : goto 6000
  75. 5240 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,25,1))*3 : hplot x,y+1 : goto 6000
  76. 5250 hcolor = val(mid$(rule$,26,1))*3 : hplot X,Y+1 : goto 6000
  77. 5260 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,27,1))*3 : hplot x,y+1 : goto 6000
  78. 5270 hcolor = val(mid$(rule$,28,1))*3 : hplot X,Y+1 : goto 6000
  79. 5280 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,29,1))*3 : hplot x,y+1 : goto 6000
  80. 5290 hcolor = val(mid$(rule$,30,1))*3 : hplot X,Y+1 : goto 6000
  81. 5300 if hscrn(x+2,y) = 3 then hcolor = val(mid$(rule$,30,1))*3 : hplot x,y+1 : goto 6000
  82. 5310 hcolor = val(mid$(rule$,32,1))*3 : hplot X,Y+1 : goto 6000
  83.  
  84. 6000 next : next
  85.  
  86. 7000 x2 = x2 + width+4 : goto 11
  87.  
  88. 9999 end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement