1) Write a program to implement Langton's Ants
2) Try to find an initial state of the grid that does not cause it to _eventually_ produce the same diagonal march behaviour.
Langton's Ants is generated thusly:
Start with a grid of cells filled with either 1's or 0's (or * and space, or any two values). The grid is effectively infinite in all directions, so any nonexplicit cells should be 0 (or space)).
Start the ant at any cell. (represented by a coordinate). Face it any direction (represented by one of the four cardinal directions).
Loop
move ant forward
if the ant finds a 0, turn it into a 1, and turn left
elif the ant finds a 1, turn it to a 0, and turn right
fi
Pool
Watch the pattern as the ant marches around! (display the grid to do this, every tick).
Eventually, Langton's Ant will get into a repeating pattern... even if you pre-populate the grid with random noise or interesting patterns. Until it does, it makes pretty pictures for you.
Do it with black and white pixels for larger tests and get neat bitmaps!
|