![]() |
![]() |
![]() |
![]() |
(..Table Part..) | Contents | Index | (..Table Part..) |
|
Perhaps you have - reading the headline of this paragraph - remembered that we
have already shown a syntax which enables assignments to arbitrary cells of
the retina, accessing them by their coordinates, in the chapter
about RDL, and you wonder why we do not use
that syntax here as well?
Simply because we do not
want to affect only those cells with certain coordinates, but all cells at the
same time! In RDL it has been our aim
to create once and forever an initial configuration.
Therefore, it has been necessary to treat different
cells in different ways; but running the simulation, the situation
changes completely: Now all state changes on the retina must be done by the
global mapping, what is realized by
applying the local rule to
all cells simultaneously.
Since SCARLET is fortunately an highly abstract programming language,
it is sufficient to write each assignment in a table only
once for all cells.
This non existent cell, which all the assignment are made to, and by which actually every site of the retina could be meant, we will call "generic cell"; its syntactical name is SELF, so that we finally get the following syntax:
(As in former cases, the semicolon is not part of CellAssignment (compare to VarAssignment; ).
Note that in SDL CellExpression
can also be a NeighbourIdentifier.
In this case CellExpression is no longer
constant but varies from cell to cell.
For this is an assignment, the
register contents of
SELF is left
unchanged, when VOID
is contents of the corresponding register of CellExpression.
SELF = left; SELF = {center.num1+1, VOID, VOID}; SELF = {VOID, right.num3, left.num2};
Finally it is again possible not to affect the whole state, but only single registers of the generic cell. According to what we have described several times before for similar situations (the most general case is found in 'Accessing Single Registers'), we first have to select the register of interest by adding its name to the cell's name separated from each other by a point. For a register with type INT e.g., we would get SELF.IntRegIdentifier; but since SELF contains no information, we omit it and type
for integer registers and
for string registers, instead.
Now it is very easy to complete the syntax, because these objects are treated again like normal variables of type INT or STRING. We get
or
respectively.
In case of an integer register we have the same short forms with the same meaning as for integer variables:
num1++;
![]() |
![]() |
![]() |
![]() |
(..Table Part..) | Contents | Index | (..Table Part..) |