Rule:Langtons-Ant-Count
@RULE Langtons-Ant-Count
@TABLE
- Emulation of Langton's Ant using a von Neumann CA
- extra states are used to code the ant's current direction:
- -----------------------------empty squares---------------------
- 0 : black
- 1 : white
- ----------------------------------------------ant is here------
- 2 : ant is facing east on a black square
- 3 : north, black
- 4 : west, black
- 5 : south, black
- 6 : east, white
- 7 : north, white
- 8 : west, white
- 9 : south, white
- ---------------------------------------------------------------
n_states:10 neighborhood:vonNeumann symmetries:none
var a={2,3,4,5} var b={6,7,8,9} var c={0,1} var d={0,1} var e={0,1} var f={0,1} var g={5,9} var h={4,8} var i={3,7} var j={2,6}
- the ant leaves:
a,c,d,e,f,0 # leaving a black square b,c,d,e,f,1 # leaving a white square
- the ant arrives:
1,g,c,d,e,5 # ant arrives on a white square from the north, now on a black square facing west 0,g,c,d,e,6 # ant arrives on a black square from the north, now on a white square facing east 1,c,h,d,e,4 # ant arrives on a white square from the east, now on a black square facing north 0,c,h,d,e,9 # ant arrives on a black square from the east, now on a white square facing south 1,c,d,i,e,3 # ant arrives on a white square from the south, now on a black square facing east 0,c,d,i,e,8 # ant arrives on a black square from the south, now on a white square facing west 1,c,d,e,j,2 # ant arrives on a white square from the west, now on a black square facing south 0,c,d,e,j,7 # ant arrives on a black square from the west, now on a white square facing north