- Write a program using dynamic arrays and class structure in C++
- Convert program requirements to program design
- Implement program design
- Conduct robust test plan
Langton’s Ant Rule
The rule of Langton’s Ant is very simple: the ant is placed onto the board that is filled with white spaces, and starts moving forward.
For each step forward, the Langton’s ant will follow 2 rules:
- If the ant is on a white space, turn right 90 degrees and change the space to black.
- If the ant is on a black space, turn left 90 degrees and change the space to white.
After that, the ant moves to the next step and continues moving forward. The ant will follow these rules, and continue moving around the board, until the number of steps runs out.
Further elaboration on this UTM (source: Wikipedia):
“Langton’s ant is a two-dimensional universal Turing machine with a very simple set of rules but complex emergent behavior. It was invented by Chris Langton in 1986 and runs on a square lattice of black and white cells. The universality of Langton’s ant was proven in 2000. ”
Sample of C++ header and implementation files for Langston’s Ant Simulation:
Program menu prints to the screen at the start to prompt user to select number of rows and columns for a dynamically allocated array, the start position (row/col) of the ant, and the number of steps for the simulation to run.
Ant tail and predictable, repeated behavior occurs around step ~11,000.
Snippet of thorough program testing plan: