previous contents index next
(..Table Part..) Contents Index (..Table Part..)

4.2.2 Entries of the Local Rule Table (Entry)

Before discussing a local rule table (short: table) as a whole, we are going to have a closer look at its components, the entries. A table is simply a listing with an arbitrary number of entries.

(This phrasing may lead to the impression that the order within the list is of no importance, but this is not right, as will soon be seen.)

The entries themselves conform to the following syntax:

Entry - Syntax:

Syntax: Entry

 

Maybe it was already expected, but after having interpreted the names of the two main parts, at the latest, it becomes rather clear that an entry is nothing else than a conditional command, similar to an IF-THEN-ELSE structure. Actually the structure of Entry is not quite so strict, but we are going to see that in detail later. Nevertheless the condition part of Entry has always got - although sometimes only indirectly - a boolean expression, which causes the devices of the Consequence part to be executed if it is TRUE, and to be skipped otherwise.


 
Example 46:

By this little example (see [6]), we would like to illustrate a bit the structure of a table and its entries.
Therefore, we take a two-dimensional lattice, sites with one integer register state, and a neighbourhood consisting of the generic cell itself as well as the eight surrounding sites. The resulting CA is meant to be a simplified model for the excitation of neurons in a brain provoked by neurons in the neighbourhood.

In our model, a cell can assume three possible states:

Furthermore we make up the following rules:

By a suitable choice of states (0, 1, 2) it can be achieved that all possible state changes can be realized by adding 1 and taking the remainder of a following division by 3. Then the belonging local rule table contains only two entries: The first entry checks whether the site is ready. If not (center.state > 0), the addition in the first consequence part will be done (and all the following entries will be ignored). If the site is ready, the first consequence part will be skipped, and SCARLET will go on with the second entry. Here it is actually not necessary to check again if center.state == 0, this is already clear. But, if the sum of neighbours with state 1 is greater than or equal to 3, - therefore, each value is bitwise compared with 1 and the results are summed up - then the site will change its state from ready to firing, otherwise it will keep its state:


SIGMA firing_neurons;

DIMENSION 2;

REGISTER INT state;

NEIGHBOUR center  : ( 0, 0);
          left    : (-1, 0);    left_lower   : (-1,-1);
          right   : ( 1, 0);    right_lower  : ( 1,-1);
          lower   : ( 0,-1);    left_upper   : (-1, 1);
          upper   : ( 0, 1);    right_upper  : ( 1, 1);

VAR INT sum;

BORDER {0};

TABLE

/* 1. entry */

   center.state > 0;  /* Condition */

   : state++; state %= 3; :  /* Consequence */

/* 2. entry */

   center.state==0;  /* Condition */
   sum=(left.state&1) + (right.state&1)
      + (lower.state&1) + (upper.state&1)
      + (left_lower.state&1) + (right_lower.state&1)
      + (left_upper.state&1) + (right_lower.state&1);
   sum>=3;

   : SELF = {1}; :  /* Consequence */

Source Code: neurons.sdl


previous contents index next
(..Table Part..) Contents Index (..Table Part..)