Home▸Algorithms & AI▸2D Langton's Ant — Cellular Automaton on a Flat Canvas (2D)

🐜 2D Langton's Ant — Cellular Automaton on a Flat Canvas

The same two-rule Turing machine as the 3D version, drawn with plain Canvas2D fillRect calls instead of a GPU texture quad: adjustable rule sets, multi-ant mode and a live highway detector.

Algorithms & AI2DEasy60 FPS📱 Mobile-adapted⇄ 3D version
2d-langtons-ant ↗ Open standalone

The 2D companion to Langton's Ant: the same two rules — turn right and flip on white, turn left and flip on black — rendered with plain Canvas2D fillRect calls instead of a GPU-uploaded texture quad, with the same rule sets and multi-ant mode.

🔬 What it demonstrates

Emergent complexity from two deterministic rules: apparent chaos for thousands of steps, then a spontaneous repeating "highway" pattern.

🎮 How to use

Pick a rule set and ant count, drag the speed slider, and watch the live panel flag the moment the mode flips from chaotic to highway.

💡 Did you know?

Whether a given multi-colour ant ever builds a highway is, in general, undecidable — a small taste of computational irreducibility.

⚙ Under the hood

Plain Canvas2D fillRect rendering of the same Langton's Ant automaton as the 3D version: adjustable rule strings, up to 10 simultaneous ants, a cell-size slider and a live steps/grid/mode readout panel.

langton's antcellular automatonturing machineemergent behaviourturmitecanvas 2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)