previous contents index next
(..Acc. Single Reg...) Contents Index (..Acc. Single Reg...)

2.9.3 Accessing Neighbours

by
NeighbourIdentifier.IntRegIdentifier (IntReg)
NeighbourIdentifier.StringRegIdentifier (StringReg)

is only possible in SDL. By NeighbourIdentifier - as an element of Identifier - a name for an existing so-called neighbour is given, while IntRegIdentifier and StringRegIdentifier are again lables for int or string registers. (They are determined by the neighbourhood.) Because neighbours do not play a part in constructing the initial configuration, they are not defined in RDL.
Registers of such objects can only be accessed reading. (Usually the states of the neighbours have an influence on the state of the "generic cell", but they themselves must not be changed at that moment.)


 
Example 26: (Resumption of example 25, compare to [6])

Now we present a local rule table, which fits the retina of the last example; it has got two entries and is intended to simulate the falling down 1-snow and its piling up on the ground. These are the rules put in words:

  1. If the generic cell is still free, and there is a snowflake above, it will have a snowflake in the next step. (The second rule will take care that the flake above will be deleted, at the same time.)
  2. If the generic cell has already got a snowflake, and there is still space in the cell beneath, it will drop it. (The first rule ensures that it is caught by the cell below.)

The border cells whose state is {35} form a boundary to this rule.


SIGMA falling_snow;

DIMENSION 2;

REGISTER INT state;

NEIGHBOUR 
            upper:   (0, 1);   /* neighbour above */
            lower:   (0,-1);   /* neighbour beneath */
            center:  (0, 0);   /* generic cell */
 
TABLE

/* 1. entry: */
 
     upper.state == 1;       /* neighbour configuration */
     center.state == 0; :    /* -"- */
     state = 1; :            /* assignment to generic cell */

 /* 2. entry: */

     lower.state == 0;       /* analogous */
     center.state == 1; :
     state = 0; : 

Source Code: snow.sdl


previous contents index next
(..Acc. Single Reg...) Contents Index (..Acc. Single Reg...)