Home › News › The winning move gets no bonus roll: a worked finish

The winning move gets no bonus roll: a worked finish

Published · By TG, the site operator

This note is a worked example of a win condition, the rule that ends a game on this board. A side wins when all four of its tokens sit on square 56, the finish. The check lives in the move code of app.js, and the two examples below follow that code step by step.

The check

After a token moves, the code looks at that side's four tokens. If every one is on 56, the game ends: the winner is recorded, the phase becomes finished, and the notice reads "All four tokens are home." Only if that is not true does the code go on to the usual next step, where a six keeps the turn.

The order matters. The win check comes first, so a six that completes the last token earns no bonus roll. The game is over on that move.

Example one: a six that finishes the game

Violet has three tokens home and its fourth token on track square 50, the last square before the home column. A roll of 6 is legal for that token, because 50 plus 6 is exactly 56. It is the only legal move, so it is made. All four tokens now sit on 56, the game ends, and the six starts no new roll.

Play out a finish like this →

Example two: a six that cannot finish

Now keep three tokens home but move the fourth to square 53. A roll of 6 would take it to 59, past the finish, so the rule does not allow it. None of Violet's tokens has a legal move. The code's no-move branch runs, and because the roll was a six, the notice reads "No legal move. Roll again." Violet keeps the turn and rolls again.

A roll of 3 would have been legal here, because 53 plus 3 is exactly 56. Moving the token onto 56 would then finish the game. A roll of 1 or 2 is also legal for that token, but it moves the token only to 54 or 55, and the game is still not over.

What a player can take from this

The same check applies to both sides, so a computer opponent can win the same way. The two examples show the rule without any simulation: the code decides the result of each move, and the figures here are read from the code, not estimated.

Try it on the board

Each example is a single move. Watch the notice after the move to see whether the game ends or the same side rolls again.

Sources

Written by the operator of this site from the sources listed above. Spotted a mistake? Email warmeve.label@gmail.com and it will be corrected.

All ludo news · Play ludo now