THE PROGRAM
DispGraph
For(Y,0,61
For(X,0,93
DelVar A
If Pxl-Test(Y,X-1
A+4→A
If Pxl-Test(Y,X
A+2→A
If Pxl-Test(Y,X+1
A+1→A
If L₁(A+1
Pxl-On(Y+1,X
End
End
This code has no extra features whatsoever to make it as small as possible, so it requires some setup to work properly.
- It is best to have axes, coordinates, expressions, plots, etc. turned off.
- There has to be some sort of input to the program to work with. All you have to do is Draw an input on the top row of pixels. It is also trivial to add a subroutine that creates a random input if that suits you better:
ClrDraw
Delvar A
For(X,0,93
RandInt(0,1→A
If A
Pxl-On(0,A
- The rule for the automaton is stored in a list (in my example L1). In order to understand how the list is stored, one must have a basic understanding of how Wolfram's automata work.
Wolfram's Automata use a simple rule table in order to take an input and return an output. In Wolfram's automata, the state of the cell and its two neighbors determine the state of the cell in the next generation (or next line)
Last Generation | New Generation |
---|---|
111 | 0 |
110 | 0 |
101 | 0 |
100 | 1 |
011 | 1 |
010 | 1 |
001 | 1 |
000 | 0 |
In this example, the three numbers from the last generation represent the state of the cell and it's neighbors, and the numbers from the new generation represent the cell's state in the new generation. So, if a cell and it's two neighbors formed a pattern of OFF-ON-OFF, or 010, the cell will be ON in the next generation, and therefore ON in the next row.
Looking down the second row of the table, an 8-digit binary number is formed, 00011110. This number is 30 in binary, so the example in the table is Wolfram's Rule 30, most famous for being very pseudo-random. Any other rule can be formed in the same way. Rule 110, notable for being turing-universal, forms 01101110 in binary. Plugging those numbers into the table gives you the rule table for 110, which is 111=0, 110=1, 101=1, etc.
And now for how the rules are implemented in my program. The binary number representing the rule is entered into each item in L1 with the LEAST SIGNIFICANT DIGIT FIRST. that means Rule 30, which is 00011110 in binary, becomes {0,1,1,1,1,0,0,0} when entered into L1. Rule 110, which is 01101110, is {0,1,1,1,0,1,1,0} when entered into L1 This provides an easy way of setting and switching rules as you please.
The most interesting rules to try are 90, 30, 110, and 60
EXAMPLE OUTPUTS
imgur .com/a/opQOS
(I'm not allowed to actually post links apparently, I hope this is okay.)