\ Hans Moravec's 1/0 symmetric Life-like rule on a triangular lattice
\.
This is a LIFE-like rule proposed by Hans Moravec that runs on a
hexagonal space. For convenience, we've embedded the hexagons into a
square lattice by using all but two opposite corners of a 3x3
neighborhood.
The notation used in the rule below encodes neighborhood by position,
and in each position indicates, for that neighborhood,
1: always set the cell to one
0: always set the cell to zero
+: keep the cell in its former state
-: toggle the cell to the opposite of its former state
The positions in the rule refer to the following neighborhoods (each
with all its rotations and reflections):
00 00 01 10 00 11 01 10 11 11 01 11 11
(0 0 0 1 (0 1 0 1 1 1)(0 1 1 1 0 1)(1 1 0 1 1 1) 1 1 1 1)
00 00 00 00 00 00 00 10 00 10 10 10 11
Here's the rule:
(00(-+0)(+--)(-+1)11)
.\
new-experiment 512 by 512 space fload 3x3.hood fload hex.xvds
: 6sum north n.east east west south s.west + + + + + ;
: neighbor 6 mod {{ north n.east east south s.west west }} ;
: -center center 1 xor ;
: longest-chain (s -- #matches.in.longest.chain )
1 1 9 0
do
i neighbor i 1+ neighbor = if 1+ else max 1 then
loop
max
;
: two-rule longest-chain {{ 0 0 0 center -center }} ;
: three-rule longest-chain {{ 0 -center -center center }} ;
: four-rule longest-chain {{ 0 0 1 center -center }} ;
: moravec 6sum {{ 0 0 two-rule three-rule four-rule 1 1 }} -> center
center -> center'
propagate
;
?rule>table moravec update-table
: Init-rand random>cam propagate-step xvds
;
press I "Initialize with a random pattern."
Init-rand