Wythoff's game (source code)

= Wythoff's game

Wythoff's game is an <impartial game> played with two finite heaps. A move removes any positive number of objects from one heap, or removes the same positive number from both heaps. Under the <normal-play convention>, the player with no legal move loses.

For example, $(0,0)$ is losing, while $(n,n)$ with $n>0$ is winning because one move empties both heaps. The position $(1,2)$ is losing: its possible moves lead to $(0,2)$, $(1,1)$, $(1,0)$ or $(0,1)$, each of which can be emptied by the next player. This directly checks a first nontrivial losing position.

The equal-removal diagonal move distinguishes the game from two-heap <Nim>, where only one heap may change in a turn. A winning strategy is determined by moving to a losing position whenever possible; identifying the complete family of losing positions is a further number-theoretic result.