Quoridor Endgames: The Wall-less Race
Every Quoridor game has a moment after which nothing surprising can happen: the last wall leaves the last supply. From then on there are two pawns, a maze that will never change again, and no legal action available to either player except walking. That makes the endgame arithmetic — and arithmetic you can do several turns before you arrive in it, which makes it less a phase you play than a destination you choose during the middlegame. Exactly one move can still shift a tempo after the last wall is gone — the jump — so the arithmetic is a verdict only once the two pawns can no longer meet.
Positions below use columns a through i, and rows 1 through 9 from your own baseline to your goal edge; your opponent starts on row 9 and runs toward row 1.
Counting the race to its end
Take the two shortest paths as already counted — Tempo and the Race covers the method. Here they stop being an estimate and become a verdict, so switch units and count in plies, half-moves, rather than turns.
Let your shortest path be m steps and your opponent's be o. If it is your move you arrive on ply 2m − 1 and they arrive on ply 2o. If it is their move you arrive on ply 2m and they arrive on ply 2o − 1. The smaller number wins.
Those two expressions can never be equal, and the reason runs deeper than the formula. Your turns are plies 1, 3, 5, and so on, so you can only ever arrive on an odd ply; your opponent can only ever arrive on an even one. Nothing either of you does disturbs that. A wasted turn pushes an arrival two plies later. A wall that lengthens a route by k pushes it 2k plies later. A jump pulls one two plies earlier. Every event in the game moves an arrival by an even number of plies, so the parity each player is stuck with is fixed from the position you are looking at right now.
Two things follow. A wall-less race can never end level: one player is strictly ahead, and the arithmetic names them. And the margin — the distance between the two arrival plies — is always odd. One, three, five, never two or four.
Why the player to move wins a tie
Set m = o = d, both pawns the same distance from home, and the count collapses to something you can hold in your head. The player to move arrives on ply 2d − 1, the player waiting arrives on ply 2d. The mover wins by one ply, at every distance.
So "we are both five squares from the finish" is not a level position. It is won for whoever is on move and lost for the other player, and the loser cannot repair it by walking, because walking is all either player can do and it advances both pawns at exactly the same rate. On a board that will never change again, the gap between two runners is frozen.
This is what makes the last wall of a game so heavy. Placing it spends a turn without advancing your pawn, which pushes your own arrival two plies later and hands the move to your opponent. If the race that would exist after that wall was already yours by a margin of one, then a wall that adds nothing at all to their path loses the game on the spot, and one that adds a single square leaves the margin exactly where it was. Measured on the margin account alone — where a forward step credits nothing and a wall that adds one square credits nothing either — it takes a wall that adds two before placing gains a turn over simply walking. That is a tempo ledger, not a full accounting: Wall Economy prices the spent wall itself as well, and by that fuller measure two is break-even rather than profit. The endgame is simply where paying it wrong is instantly fatal rather than merely expensive.
The margin is a budget of free turns
Because margins are odd they convert cleanly into spare turns. A margin of M plies gives you (M − 1) / 2 turns you can spend on anything at all and still arrive first. Margin 1: none, every move must be forward. Margin 3: one free turn. Margin 7: three.
Everything that is not a forward step draws on that one account. A wall costs a turn. A sidestep that leaves you the same distance from your goal row costs a turn. A step backwards costs two, for the reason built into the distance model in Tempo and the Race. A wall is the only entry that can also pay in: it credits the account with k − j − 1 turns, using the exchange rate Wall Economy derives — which is why, at a margin of one, a wall worth k = 1 is exactly free and a wall worth k = 0 ends the game.
Once you know the margin you stop asking whether a move is worth it in the abstract and start asking whether you can afford it, which is a much easier question and one you can answer exactly. It also tells you when to stop calculating: with a projected margin of 9 you do not need the best move, you need to avoid throwing away five turns, which no reasonable sequence does. Save the effort for margins of 1 and 3, where a single careless sidestep is the whole game.
When the count is a verdict, and when it is not
All of the above assumes every move covers one row. One move does not. The jump crosses an adjacent pawn and covers two, which makes it the only remaining way a tempo can change hands once the walls are gone — and it changes hands by exactly one tempo, two plies, the same size as the smallest possible margin. So before trusting a margin of 1 or 3, ask a second question: can these two pawns ever become adjacent?
If they are in different columns and neither can be forced back into a shared one, they cannot, the count is final, and you can stop thinking. If they are walking toward each other down the same column, work out who is forced to close the gap, because that player is the one who hands over the tempo. Count the rows between the pawns. With you to move, an even gap means you are the player who eventually steps into contact and your opponent collects the jump; an odd gap means they must step in and you collect.
Worked: your pawn on e3, six rows from row 9. Theirs on e7, six rows from row 1. Empty board, your move. The arithmetic says you arrive on ply 11 and they arrive on ply 12 — a proven win by a margin of one. But the gap is four rows, which is even, so it is yours to close. You walk to e4, they walk to e6, you walk to e5, and now their forward square is occupied: they jump straight over you and land on e4, three from home instead of four. They arrive on ply 10 and you on ply 11. The position was lost before you touched a piece, and the count never said so.
Nor does sidestepping out of the column save it. Leaving costs one turn, two plies, which is precisely the swing you were trying to dodge — the contact tax is one tempo whichever currency you pay it in, and a margin of one cannot pay it. A margin of three can, and buying your way out of a shared column is one of the better uses of that free turn. One further check before you rely on collecting a jump yourself: the straight jump is not always the move you get, under conditions The Complete Rules sets out exactly. What matters for the count is that the diagonal you fall back to is ordinary progress — one row nearer, no tempo gained — so a contact you were banking on to swing two plies can arrive and swing nothing. Check for it before you let a margin of one depend on it, and treat the tempo as collected only when the square straight beyond the pawn is reachable. Openings covers the face-off that produces these contacts in the first place.
Steering into an endgame you have already won
At any point in the middlegame you can ask two questions with exact answers: if both of us stopped placing walls right now, who wins, and can the pawns still meet? Together they should govern how you spend what is left in your supply.
If the projected race is yours, you want walls to leave the board. Every wall spent is one fewer way the position can still change, and a player who is ahead is served by certainty. But watch which supply is emptying — "few walls left" is not the safe condition, "few of theirs" is (Wall Economy prices what a held wall is worth). Three walls against an opponent's six, while ahead by a margin of one, is not a won endgame at all.
If the projected race is not yours, letting the board empty out is a way of resigning slowly; walls are the only source of variance you have left, and Traps and Cages is where that variance is largest. A structure is a middlegame instrument, though. Once both supplies are empty no new detour can be created, so a cage that has not been built by then never will be. The mirror of that is the best reason to build one late: a detour created with the final wall is permanent, and it lands on a position that can no longer be repaired.
How this site handles these positions
The bot here does not search wall-less endgames, because there is nothing in them
to search. When a two-player position has both wall supplies at zero, the engine
solves it outright — it reads each side's shortest path length, converts the two
distances into arrival plies exactly as above, and returns a proven win or loss
together with the margin (src/lib/quoridor/engine/endgame.ts). That check runs
before any search tree is built, second in the pre-search order behind the opening
book, and when it fires the bot plays its shortest-path step, or a fallback move
if no shortest-path step is legal
(src/lib/quoridor/engine/mcts/engine-v3.ts).
It is worth knowing where that verdict is thin. Those distances come from a breadth-first search over the walls alone: the pawns are not on the board it searches, so no jump is ever modelled. In a shared-column race the engine's "proven" is exactly as trustworthy as the contact test in the previous section and no more — which is one more reason to arrive in an endgame whose result does not hang on a single tempo. The middlegame decision that puts you there, move by move, is Wall or Advance.