Python script for creating a Langton's Ant cellular automata
✓ Published0🌍 Public
Aabehmiel
Last edited Mar 28, 2017
Created on Mar 28, 2017
This example visualizes Langton’s Ant cellular automata on a 128-by-128 finite grid, showing the emergent trail of black and white cells as one or more ants move according to a configurable turning rule. The simulation runs up to 11,000 steps, then renders the final board state and ant positions using Matplotlib’s `imshow` with a gray colormap and a red overlay via `numpy.ma` masks. The code defines `Grid` and `Ant` classes in Python, uses NumPy arrays for the board, and saves the output as a PNG image.
AI-generated description