This program is a stripped down version of a cellular automata drawing tool I made. I think one-dimensional cellular automata so cool, because they make such awesome patterns out of something so simple! There is a good page on Wolfram MathWorld on elementary cellular automata if you want to learn how they work!
For now, all you need to know to help with this program is that there is a line of cells across the top, and each one is either on or off. When it advances to the next generation of cells (drawn in on the next line), it changes one cell's state based on the cell to the left and the cell to the right. Because of this, the program has to check each cell in the row to determine if it should stay on, stay off, or change state. I am hoping there is a faster way to do this, since right now it takes a very long time to draw an entire screen.
W is the width of the screen that the calculator is drawing on (and it is centered at 132, the middle of the screen for a TI 84 CE)
Str1 is an 8 digit string of zeroes and ones. The calculator determines how a cell should change by checking the cell and its left and right neighbor and turning that into a number 1-8 (because there are 8 different states the 3 cells could be in). The number corresponds to a digit in Str1 and determines if that cell should be on or off. Str1 can be changed to show any of the rules for cellular automata.
For(Y,0,163)
For(X,132-W/2,132+W/2)
If expr(sub(Str1,8-4(pxl-Test(Y,X-1))-2(pxl-Test(Y,X))-pxl-Test(Y,X+1),1
Pxl-On(Y+1,X
End
End
There are online programs that can do this in a matter of seconds. Is there a way I can make this loop run faster? I have tried referencing a list of 8 numbers instead of a string, but it didn't appear to run faster. I'm hoping there is something that I have missed, but it's possible that a calculator just can't run any faster. If you have any ideas of how to speed this up, I would greatly appreciate it!