Skip to content

rgambee/knight-grid

Repository files navigation

Knight Grid

This app creates striking patterns by placing chess pieces according to a set of simple rules. It's a lovely example of emergent behavior.

I got the idea from this Numberphile video featuring Neil Sloane. Credit also goes to Jonas Karlsson for inspiring parts of the design.

Explanation

Placement Rules

The board is an infinite grid. The squares are numbered, starting with 1 in the center and spiraling outward.

Each player has exactly one type of piece they can play. A knight is the classic example. On each turn, the player places a piece in the lowest-numbered square which is not threatened by an opponent.

See the Numberphile video for a clearer explanation.

Piece Types

The game works best with leaping pieces, i.e. non-sliding ones which can move in any direction. Only one standard chess piece meets these criteria: the knight. But we can use alternative pieces to create different patterns.


Copyright © 2026 Robert Gambee

About

Simple rules, surprising patterns

Resources

License

Stars

Watchers

Forks

Contributors