The goal of this project is to simulate Langton's Ant (https://en.wikipedia.org/wiki/Langton%27s_ant), a cellular automaton that follows two simple rules with each step in a matrix of cells.
The project was created during course work in C++ and designed to run in a Linux terminal.
To implement a simulation of Langton's Ant, showing the movement of the ant with a change in color based on two rules:
- In a white square, ant turns right 90 degrees and changes the square from white to black
- In a black square, the ant turn left 90 degrees and changes the square from black to white
(i) Grid size
(ii) The simulation continues for a user-defined number of steps.
(iii) Starting location of the ant
Along with instructions and prompts, Blank grid with borders on the right and left delineating
the boundaries.
Grid cell if black shown with "#", while white is just blank space
- Use of wrap-around option so that the grid appears not to have an edge. This ensured that the ant could execute the number of steps specified by the user.
- Printing of the grid with each forward movement of the ant, instead of re-rendering the grid each time. I used ANSI escape codes and created two functions to control the cursor movements. Other enhancements results from the Test Results and are described in the design document.
Specifications of the project are given in the specs.txt file.
Design decisions are in the design document which includes the test plan and the test results. Changes made to the program as a result of the test plan are also included in this document.
To run the program, ensure that all files from the code folder are downloaded in the same location. Run the make command in the terminal.