3. The Rule in Action
The previous pages have disected the rule in order to explain each line. Below is an example of the rule in action.
After loading the rule, the CA space should look like this at Epoch 0 (stage 0).
Next, compile the rule. For help on compiling, refer back to the basic Trend tutorial. Once it is compiled successfully, use the controls to increase the Epoch number. Below is what Epoch 1 should look like.
In Epoch 1, the symbol o appears to have spread to the right. There are now two symbols in the CA space. This was caused by lines 15 and 16 of the rule being applied to the original symbol in the CA space.
15 |
if (ctrl==0 && left:ctrl) // if CTRL is nothing and LEFT CTRL is "alive" |
16 |
ctrl=left:ctrl-1;//assign CTRL the value LEFT CTRL -1 |
Going back to epoch 0, in the image below the red X has been placed in the CA space to show the particular cell we will be applying lines 15 and 16 to. This X is just to show the position, and has nothing to do with the rule itself.
Looking at lines 15 and 16, the position with the red X has a value of zero for the field ctrl. And the position to the left of it has a value of something other than zero. This satifies the condition in line 15, so line 16 is to be executed when moving to Epoch 1. That is shown in the image above with the two o symbols in the CA space. The rule is causing the appearance of the symbols spreading to the right.
The images above show that the spreading continues as the number of epochs increases. This will continue until the symbols reach the right-hand side of the screen. At that point, the lines 15 and 16 no longer apply to the symbols in the CA space.
|