08-19-2022, 02:15 PM
Did not know (or forgot) Sierpinski Triangle can be made with Celluar Automata on lines only ie neighbor counts of 3 cells above the cell in question!
Code: (Select All)
_Title "Cellular 1 or 2 of 3 Rule"
Screen _NewImage(1300, 700, 32)
_ScreenMove 40, 0
DefLng A-Z
s = 2
n = 1300 / s - 2
Dim a(0 To n + 1), ng(0 To n + 1)
a(n / 2) = 1
y = 0
While y < 700
For i = 1 To n
sum = a(i - 1) + a(i) + a(i + 1)
If sum = 0 Or sum = 3 Then
ng(i) = 0
Line (i * s, y)-Step(s, s), &HFF000000, BF
ElseIf sum = 1 Or sum = 2 Then
ng(i) = 1
Line (i * s, y)-Step(s, s), , BF
End If
Next
y = y + s
For i = 1 To n
a(i) = ng(i)
Next
Wend
Sleep
b = b + ...