Sloane's Knights

?

Simulation Controls

Spiral

Spiral size: 160800 = (2k + 1)^2 - 1

Canvas

Computed cell size: 2px

Players

Player 1 (Knight #1)

Move set (dx, dy)?

Enemies to avoid?

Player 2 (Knight #2)

Move set (dx, dy)?

Enemies to avoid?

Canvas Output

What is this?

This is a simulator for (a generalized version of) Sloane's Knights game as described in this Numberphile video and this OEIS article.

Consider a square spiral with its cells numbered starting at 0. The spiral is centered at the origin, with the center cell being 0 and the spiral expanding outward in a counter-clockwise direction.

Each player takes turns placing their pieces on the spiral (represented by their color). Each player places their piece on the lowest available cell in the spiral, where “available” means the cell is both not already occupied by another player's piece and is not within a move's reach of any of the player's enemies' pieces.

The default configuration describes Sloane's original game: two players, each with a knight piece trying to avoid the other player.

In this simulator, you can customize the number of players, their move sets (which cells their pieces threaten), and which players they must avoid.

The simulator contains a number of preset player types, that are taken from Jonas Karlsson's discussion on it here.

Find source code for this website here.