Hex
Play Hex against a computer that plays 4x4 perfectly — and see the no-draw theorem counted out over all 65,536 ways to fill a board.
Click a cell to place a stone. Red joins the top edge to the bottom; Blue joins the left edge to the right. There are no captures and no passes, and the game cannot be drawn. Everything runs in your browser; nothing is uploaded.
Hex cannot be drawn — counted, not argued
Fill every cell of a Hex board however you like — at random, adversarially, ignoring whose turn it was — and exactly one player is left holding a connection. Never both, and never neither. Here is every possible filling of the small boards, checked one at a time:
| Board | Fillings | Red joins | Blue joins | Both | Neither |
|---|---|---|---|---|---|
| 2 × 2 | 16 | 8 | 8 | 0 | 0 |
| 3 × 3 | 512 | 256 | 256 | 0 | 0 |
| 4 × 4 | 65,536 | 32,768 | 32,768 | 0 | 0 |
Both columns are zero at every size — that is the theorem in full. The neither column is the half worth pausing on: it says a purely defensive arrangement does not exist. There is no way to place your stones so that your opponent is blocked without your own two sides being joined in the process. In Hex, blocking is connecting, and the geometry forces it rather than the rules stating it.
The two colours also take exactly half the fillings each — 32,768 apiece at 4 × 4, not approximately. Transposing the board and swapping the colours turns every red win into a blue win, which pairs the two sets off one for one. That mapping was checked on every filling rather than left as an argument.
The first player wins — and here are the actual moves
Strategy stealing proves the first player wins at every board size: if the second player had a winning strategy, the first could play anywhere, then follow it, and an extra stone on the board is never a disadvantage in Hex. The argument is airtight and completely non-constructive - it names no move. The openings above were found by solving the board instead.
| Board | Openings that win | Share | Which ones |
|---|---|---|---|
| 2 × 2 | 2 of 4 | 50% | r1c2 r2c1 |
| 3 × 3 | 5 of 9 | 56% | r1c3 r2c1 r2c2 r2c3 r3c1 |
| 4 × 4 | 4 of 16 | 25% | r1c4 r2c3 r3c2 r4c1 |
At 4 × 4 the winning openings are exactly the four cells of the short diagonal — r1c4, r2c3, r3c2, r4c1 — the line running against the direction of both players' goals. Every other opening loses to correct play. Play the 4 × 4 board above and the computer will take one of those four and never lose; go first yourself and pick anything else, and it will beat you.
What that table does not show is a trend. The share rises from 50% to 56% before collapsing to 25%, so it is not narrowing with size — three boards and a sequence that goes up then down establish nothing about where it goes next. The 5 × 5 board that would settle it needs far more search than this can do; solving 4 × 4 alone takes 2.3 million positions.
How to use
- Pick a board size and which colour you play.
- Click a cell to place a stone.
- Red joins the top edge to the bottom; Blue joins the left edge to the right.
- There are no captures and no passes — and no draws.
- The 4x4 board is solved, so the computer there plays perfectly.
Frequently asked questions
What are the rules of Hex?
Players take turns placing a stone on any empty cell of a rhombus of hexagons. Red tries to join the top edge to the bottom, Blue the left edge to the right. Stones are never captured or moved, and there is no passing. The first player to complete a connection wins.
Can a game of Hex end in a draw?
No, and not by convention — it is impossible. Fill a board completely, however you like, and exactly one player is left holding a connection. Counting every one of the 65,536 ways to fill a 4x4 board, the number with two winners is zero and the number with none is also zero.
Why does that mean blocking is the same as connecting?
Because there is no filled board where nobody has won. If you could arrange your stones purely to block, you would have a filled board where your opponent is stopped and you have not connected — and no such board exists. Any arrangement that blocks your opponent has already joined your own two sides.
Does the first player always win at Hex?
Yes, on any board size, by a strategy-stealing argument: if the second player had a winning strategy, the first could play anywhere, then follow it, and an extra stone is never a disadvantage in Hex. The argument is airtight and names no move at all — it proves a winning strategy exists without showing you one.
So which opening moves actually win?
That needs solving the board rather than the theorem. At 2x2, two openings of four win; at 3x3, five of nine; at 4x4, four of sixteen — and those four are exactly the short diagonal, r1c4, r2c3, r3c2 and r4c1. Note the share goes up before it goes down, so three board sizes show no trend.
Why is only the 4x4 board played perfectly?
Because it is the largest one that can be solved here. Solving 4x4 takes about 2.3 million positions and fifteen seconds, so the first reply is looked up from a table solved in advance and the rest is solved as you play. Larger boards use an opponent that compares how many stones each side still needs.
Who invented Hex?
Piet Hein in 1942 and, independently, John Nash a few years later — which is why it was known for a time as Nash. The no-draw property is equivalent to a fixed-point theorem, and the game was designed around it rather than the property being noticed afterwards.
Does this send anything anywhere?
No. Every game is played and solved entirely in your browser, and nothing is uploaded.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.