Turning Corners a coin at (a, b) is worth a ⊗ b

A move picks a heads coin and a cell above and to the left of it, and turns over the four corners of that rectangle. The picked coin must go heads → tails; the others flip either way. Corners in the grey edge row and column (row 0, column 0) are off the board, so a move turns 4, 2 or 1 coins. Whoever cannot move loses. The coin at (a, b) is worth the nim-product a ⊗ b and a position is worth the XOR of its heads: pick a coin, and corners marked ✓ leave XOR 0 behind, ✗ do not.

value of the position

checked from the definitions

the nim-product table

hover a cell

nim arithmetic

why the corners multiply

A single heads coin at (a, b) can be turned together with any (a′, b), (a, b′), (a′, b′) above and to its left, so its value is the mex of v(a′, b) ⊕ v(a, b′) ⊕ v(a′, b′). That recursion is Conway's definition of a ⊗ b, and it makes the numbers below 2, 4, 16, 256, 65536, … into fields of those sizes with XOR as addition.

Coins add up by XOR

Turning a tails coin to heads is the same as adding a second heads coin on the same spot, and two equal games cancel. So a position is the sum of its heads coins, and its value is the XOR of theirs. The page's tests and tools/compute.mts do not take this on trust: they solve every position of small boards (all 2²⁵ on 5 × 5) by mex over the moves.

The Tartan theorem

Turning Corners is the product of a one-dimensional game with itself: turn two coins in a row (Nim, coin x worth x). For any two coin-turning games, the product (a move is a move of each, turning every coin of their cross product) gives the coin (x, y) the value g(x) ⊗ h(y). Checked here for products of Nim, Ruler and Mock Turtles.

Mogul and the Golay code

In Mogul you may turn up to seven coins in a row. Two lost positions can never be a move apart, so they differ in at least eight coins: on 24 coins the lost positions are the 4096 words of the extended Golay code, 759 of them with eight heads.