I made a program that renders all the rules of cellular automata (Rules 0 - 255) and it's extremely slow but it works. Perhaps people with ideas for optimization can post below but here's the code:
Code:
Rule 126:
Rule 110 (My favorite )
There are no spritesheets for this program so if you want to test it then you can use that code. Any optimizations are welcomed and Thanks in advance for those who reply! [/img]
Code:
real(0,1,1
real(8,1,0
real(7,9,0,0,160,120,255,0
"CELLULAR AUTOMATA^RENDERER
real(6,0,10,10,0,94,0
"(ENTER)
real(6,0,10,50,0,0,0
Pause
real(0,1,0,1
ClrHome
While R>0-1 and R<256
Input "RULE? (0-255)",R
End
8->dim(|LBRULE
Fill(0,|LBRULE
ClrHome
If R/2!=int(R/2
1->|LBRULE(8)
While R>1
ClrHome
1->B
0->A
While A<=R
2^B->A
B+1->B
Output(2,1,A/2
Output(3,1,B-1
Output(4,1,R
End
1->|LBRULE(8-(B-2
R-(A/2->R
End
real(0,1,1
real(8,1,0
real(7,9,0,0,160,120,255,0
160->dim(|LLINE
160->dim(|LLINE2
Fill(0,|LLINE
Fill(0,|LLINE2
1->|LLINE(80
real(7,9,80,0,1,1,0,0
1->X
1->Y
For(I,1,118
For(J,1,158
X+1->X
(4*|LLINE(X-1))+(2*|LLINE(X))+|LLINE(X+1)->R
If |LBRULE(8-R)=1:Then
1->|LLINE2(X)
real(7,9,X,Y,1,1,0,0
End
End
1->X
Y+1->Y
|LLINE2->|LLINE
Fill(0,|LLINE2
End
Pause
DelVar |LLINE:DelVar |LLINE2:DelVar |LBRULE
Rule 126:
Rule 110 (My favorite )
There are no spritesheets for this program so if you want to test it then you can use that code. Any optimizations are welcomed and Thanks in advance for those who reply! [/img]