staff project download information miscellaneous
Trend Download   One Cellular Automata
  Download

Trend Tutorials
Trend Basics
Game of Life
One Dimensional CA
Mouse Maze
1-D Bubble Sort
Animation


More Trend Examples

 
MangoVect DownloadPicky DownloadLucy2 DownloadGRAMAUBViz DownloadgeneDBN Download
2. Examining the Rule

The purpose of this rule is to show the ability of TREND to give the appearance of movement in a one dimensional manner on the CA space. In this example, a symbol will start in the upper left hand corner of the screen and will spread to the right until the entire top line is filled with the symbol. Then it will start to spread downward on the screen again until the entire screen in filled with the symbol.

Epoch 0

Epoch 38

Epoch 78

The table below is a copy of the code shown on the first page. There are several lines with nothing but comments. This is done for easy interpretation and to make it more readable. The comments are shown in bold. Each line is numbered in the table below to allow the code to be looked at line by line.

line
code
1 default cell=cell;// has values of 0,1,2 and .
2 default ctrl=ctrl;// value will be assigned when you choose the symbol
3
4 /*******************************************************************************/
5 /*************************DECLARATIONS*************************************/
6 /*******************************************************************************/
7
8 int sum; // initialize integer named "sum"
9 int table[]={0, 0, 2, 0, 2, 0, 1}; //initialize integer named "table"
10
11 /*******************************************************************************/
12 /************Code to Perform the Movement From Left to Right*********************/
13 /*******************************************************************************/
14
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
17
18 else if (no:ctrl==down:ctrl && ctrl>1) // if the TOP CTRL is equal to DOWN CTRL & CTRL>1
19 ctrl--; // only reduce by 1 if greater than 1
20
21 /*******************************************************************************/
22 /***************Code to Perform the Movement Down the Screen********************/
23 /*******************************************************************************/
24
25 if (no:ctrl==top:ctrl+1 || no:ctrl==0 && top:ctrl==225)
26 {
27 ctrl=no:ctrl+1;
28 sum=nw:cell+no:cell+ne:cell;
29 cell=table[sum];
30 }
31 /*If NO CTRL is equal to TOP CTRL plus 1, then CTRL is assigned the value
32 of NO CTRL plus 1 and sum is assigned the value of NW:CELL + NO:CELL + NE:CELL and cell
33 is assigned the value of the array sum.*/


Last modified June 13, 2008 . All rights reserved.

Contact Webmaster

lab