Langton’s Ant

Follow the binary ant’s turns, cell flips and movement; inspect its trail, position and next turn.

About this tool

The ant stands on the current cell before each step. White turns it 90° right; black turns it 90° left. It then flips that cell once and moves one cell in its new direction. North is up, east is right; displayed columns and rows start at 1. Black cells count the current black field, not the number of flips. Every completed step flips exactly one cell.

Wrap connects opposite edges into a torus. Stay at edge preserves this tool’s clamp variant: after an outward move is attempted, the turned ant remains on the edge cell it just flipped. Its next step reads that cell again. Both boundaries are finite conventions, not an infinite lattice; no highway or universality result is promised.

Step always pauses playback before one exact step. Apply validates the settings. A changed size preserves the overlapping trail; a size or boundary change resets the counter, while a rate-only change keeps it. Set ant retains the trail and resets the count only when its pose changes. Position drafts act only when Set is pressed and remain untouched during playback.

Reset ant returns to the centre facing north, with zero steps and the trail retained. Clear field also erases the trail. In Place mode, a tap places the ant on release while preserving its heading; cancellation does not place it. Arrow keys move the cursor, and Space places the ant in Place mode. View keeps native touch and wheel scrolling.

Playback processes at most eight steps per frame and reports discarded waiting time without skipping model steps. Hiding the tool or browser tab pauses it. Saved data use the existing 1,500-character encoded-state limit; a warning appears if saving is unavailable. Reload restores a saved trail, exact pose and step count paused; the last-step description is cleared. Larger fields remain usable in the current session.

Rule and torus reference: Hagiwara & Tsukiji (2020). This display uses the ant-on-cell, turn–flip–move convention.