Slight change to documentation, clarifying the meaning of distance.
This commit is contained in:
parent
07628817bd
commit
d28152084f
34
README.md
34
README.md
|
@ -23,7 +23,7 @@ It returns a new cell, based on the cell passed.
|
||||||
|
|
||||||
Actions of the rule will (can only) modify properties of the cell; there are two
|
Actions of the rule will (can only) modify properties of the cell; there are two
|
||||||
properties which are special and SHOULD NOT be modified, namely the properties
|
properties which are special and SHOULD NOT be modified, namely the properties
|
||||||
__x__ and __y__.
|
__x__ and __y__.
|
||||||
|
|
||||||
### Execution
|
### Execution
|
||||||
|
|
||||||
|
@ -97,13 +97,13 @@ A _condition_ is one of:
|
||||||
|
|
||||||
#### About neighbours
|
#### About neighbours
|
||||||
|
|
||||||
Note that everywhere above I've used 'neighbours', you can use 'neighbours
|
Note that everywhere above I've used 'neighbours', you can use 'neighbours
|
||||||
within _distance_'.
|
within _distance_', where _distance_ is a (small) positive integer.
|
||||||
|
|
||||||
A cell has eight immediate neighbours - cells which actually touch it (except
|
A cell has eight immediate neighbours - cells which actually touch it (except
|
||||||
for cells on the edge of the map, which have fewer). If the cell we're
|
for cells on the edge of the map, which have fewer). If the cell we're
|
||||||
interested in is the cell marked 'X' in the table below, its immediate neighbours
|
interested in is the cell marked 'X' in the table below, its immediate neighbours
|
||||||
are the ones marked '1'. But outside the ones marked '1', it has more distant
|
are the ones marked '1'. But outside the ones marked '1', it has more distant
|
||||||
neighbours - those marked '2' and '3' in the table, and still more outside those.
|
neighbours - those marked '2' and '3' in the table, and still more outside those.
|
||||||
|
|
||||||
<table style="padding-left: 20%;">
|
<table style="padding-left: 20%;">
|
||||||
|
@ -116,7 +116,7 @@ neighbours - those marked '2' and '3' in the table, and still more outside those
|
||||||
<tr><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td></tr>
|
<tr><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td><td style="width: 1.5em; background-color: chartreuse;">3</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
If a rule just says 'neighbours', and not 'neighbours within', it means
|
If a rule just says 'neighbours', and not 'neighbours within', it means
|
||||||
'neighbours within 1'; so
|
'neighbours within 1'; so
|
||||||
|
|
||||||
if some neighbours are scrub then state should be scrub
|
if some neighbours are scrub then state should be scrub
|
||||||
|
@ -129,7 +129,7 @@ has exactly the same meaning as
|
||||||
|
|
||||||
In these rules, _actions_ is one of:
|
In these rules, _actions_ is one of:
|
||||||
|
|
||||||
+ _action_
|
+ _action_
|
||||||
+ _action_ and _actions_
|
+ _action_ and _actions_
|
||||||
|
|
||||||
and _action_ is:
|
and _action_ is:
|
||||||
|
@ -140,33 +140,33 @@ and _action_ is:
|
||||||
#### Properties
|
#### Properties
|
||||||
|
|
||||||
In the above, _property_ is the name of any property of a cell. Any alpha-numeric
|
In the above, _property_ is the name of any property of a cell. Any alpha-numeric
|
||||||
string of characters can form the name of a property. Actions should __NOT__
|
string of characters can form the name of a property. Actions should __NOT__
|
||||||
try to change the reserved properties __x__ and __y__.
|
try to change the reserved properties __x__ and __y__.
|
||||||
|
|
||||||
#### Values in Conditions
|
#### Values in Conditions
|
||||||
|
|
||||||
Values in conditions and actions are considered slightly differently. In a
|
Values in conditions and actions are considered slightly differently. In a
|
||||||
condition, a value is one of:
|
condition, a value is one of:
|
||||||
|
|
||||||
+ _symbolic-value_
|
+ _symbolic-value_
|
||||||
+ _numeric-value_
|
+ _numeric-value_
|
||||||
|
|
||||||
The '...more than...' and '...less than...' conditions imply a _numeric-value_.
|
The '...more than...' and '...less than...' conditions imply a _numeric-value_.
|
||||||
Thus "if altitude is more than fertility..." is interpreted as meaning "if the value
|
Thus "if altitude is more than fertility..." is interpreted as meaning "if the value
|
||||||
of the property of the current cell called 'altitude' is greater than the value
|
of the property of the current cell called 'altitude' is greater than the value
|
||||||
of the property of the current cell called 'fertility'", whereas the apparently
|
of the property of the current cell called 'fertility'", whereas the apparently
|
||||||
similar condition 'if altitude is fertility...' is interpreted as meaning
|
similar condition 'if altitude is fertility...' is interpreted as meaning
|
||||||
"if the value of the property of the current cell called 'altitude' is the symbol
|
"if the value of the property of the current cell called 'altitude' is the symbol
|
||||||
'fertility'".
|
'fertility'".
|
||||||
|
|
||||||
Thus _symbolic-value_ is any sequence of alphanumeric characters, whereas
|
Thus _symbolic-value_ is any sequence of alphanumeric characters, whereas
|
||||||
_numeric-value_ is one of:
|
_numeric-value_ is one of:
|
||||||
|
|
||||||
+ _number_
|
+ _number_
|
||||||
+ _property_
|
+ _property_
|
||||||
|
|
||||||
and _number_ is any sequence of the decimal digits 0...9, the minus character
|
and _number_ is any sequence of the decimal digits 0...9, the minus character
|
||||||
'-' and the period character '.', provided that the minus character can only be
|
'-' and the period character '.', provided that the minus character can only be
|
||||||
in the first position, and the period character can only appear once.
|
in the first position, and the period character can only appear once.
|
||||||
|
|
||||||
#### Values in Actions
|
#### Values in Actions
|
||||||
|
@ -185,12 +185,12 @@ and _operator_ is one of the simple arithmetic operators '+', '-', '*' and '/'.
|
||||||
|
|
||||||
### Shorthand
|
### Shorthand
|
||||||
|
|
||||||
Note that '...neighbours are...' is equivalent to '...neighbours have state equal to...',
|
Note that '...neighbours are...' is equivalent to '...neighbours have state equal to...',
|
||||||
and 'some neighbours...' is equivalent to 'more than 0 neighbours...'
|
and 'some neighbours...' is equivalent to 'more than 0 neighbours...'
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright © 2014 [Simon Brooke](mailto:simon@journeyman.cc)
|
Copyright © 2014 [Simon Brooke](mailto:simon@journeyman.cc)
|
||||||
|
|
||||||
Distributed under the terms of the
|
Distributed under the terms of the
|
||||||
[GNU General Public License v2](http://www.gnu.org/licenses/gpl-2.0.html)
|
[GNU General Public License v2](http://www.gnu.org/licenses/gpl-2.0.html)
|
||||||
|
|
Loading…
Reference in a new issue