PROJECT EULER · #0349
Langton's Ant
An ant moves on a regular grid of squares that are coloured either black or white.
The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves from square to adjacent square according to the following rules:
- if it is on a black square, it flips the colour of the square to white, rotates
- if it is on a white square, it flips the colour of the square to black, rotates
Starting with a grid that is entirely white, how many squares are black after
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.