Files
ProLibertateGames/docs/RULES-backgammon.md
Claude 284f9f3f95 Add Checkers, Backgammon, Mastermind, and Pirates and Bulgars
The four games that were listed but not written. Nothing in the
catalogue is marked "coming soon" any more.

Checkers is English draughts on the thirty-two dark squares, numbered
the way the game is written down. Captures are compulsory and a multiple
jump is one move object, so a player cannot stop halfway through one —
true by construction rather than by a rule that has to be enforced
somewhere. The move generator matches the published perft counts at one
to four ply (7, 49, 302, 1469), which fold in compulsory capture,
crowning and the men's forward-only rule all at once.

Backgammon's hard rule is not how a checker moves but that a player must
use as much of the roll as they can, and that cannot be checked one move
at a time: a move can be illegal precisely because playing it strands
the other die. So the generator works backwards from whole turns —
memoised depth-first over the remaining dice — and offers only the first
steps of the longest plays. Recomputing it after each checker is what
makes the rule true by construction. Every die comes from the table's
seed and a count of rolls made, which is in the state rather than beside
it so a game is reproducible from what crosses the wire. There is no
doubling cube; the rules document says so plainly.

Mastermind is played as a duel — both players are set a code and both
are breaking one — because the pencil-and-paper game gives the codemaker
nothing to do. It ends at the foot of a round, never mid-round, or going
first would be worth half a guess. It is the one game here with anything
to hide, so viewFor does real work: the host sends each device only its
own code, and a device that was never given a code refuses to score a
guess against it rather than quietly answering "nothing".

Pirates and Bulgars is Sackson's theming of Asalto, and the rules
document is explicit about which parts are attested and which had to be
chosen — the book could not be obtained. Two hunters who take by
jumping against twenty-four who cannot take at all, on a thirty-three
point cross whose drawn lines come from the same adjacency table the
moves come from, so the board and the rules cannot disagree.

130 unit tests across the four engines, all run locally as well as in
CI: game/ has no Android in it, which is what makes that possible.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019Pr6B8xDDtJJcb6WJMw7Ud
2026-08-07 07:58:12 +00:00

97 lines
4.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Backgammon
Twenty-four points, fifteen checkers a side, and two dice. Bring everything
round to your home board and bear it off before your opponent does.
## The board
Points are numbered 1 to 24. **White runs down the numbers and bears off past
1; Black runs up them and bears off past 24.** White's home board is points 1–6,
Black's is 19–24.
A point belongs to whoever has two or more checkers on it, and is closed to the
other player. A point with exactly one checker on it is a **blot**, and can be
hit.
## The opening
Each player throws one die and the higher number starts, playing both dice as
thrown. A tie is thrown again, so the game never opens on a double.
## A turn
Throw two dice and move one checker for each. **A double is four moves**, not
two.
The rule that decides most disputes is this one: **you must use as much of the
roll as you can.** If there is a way to play both dice, you must play both, even
when playing one would suit you better. If only one can be played, it must be
the higher one. The app enforces this by working out every way the whole roll
could be played before offering you anything, so a move that would strand the
other die is simply never on the board. That is why a legal-looking move
sometimes cannot be tapped: playing it would waste half your roll.
## Hitting and the bar
Landing on a blot sends it to the bar. A player with a checker on the bar must
bring it back on before moving anything else, entering in the opponent's home
board: White enters on 24 minus the die, Black on the die itself. If every entry
point is closed the turn is lost, and it can be lost several times over.
## Bearing off
Once all fifteen checkers are in your home board you may start bearing off. An
exact die takes a checker off the point that needs it. A bigger die may take one
off your highest occupied point, but only when nothing is standing further back —
an overshooting die may never take a checker that a smaller die could have
reached.
## Winning
Fifteen off wins. How much it is worth depends on how badly the loser lost:
| | |
| --- | --- |
| **Single**, 1 point | the loser has borne at least one checker off |
| **Gammon**, 2 points | the loser has borne nothing off |
| **Backgammon**, 3 points | and still has a checker on the bar or in the winner's home |
Counting gammons is an option. It changes nothing about the moves and everything
about whether a hopeless game is worth playing out.
## Not implemented
**There is no doubling cube.** A single game is played rather than a match to a
number of points, and with nothing being kept between games there is nothing for
a cube to double. It is the largest thing missing from this implementation and
the one a serious player will notice first.
## The dice
Every die in the game comes from the table's own seed and a count of how many
rolls have been made, so a game is reproducible from the state it started in and
a host and a client can never disagree about what was thrown. The seed travels
with the state, which is safe: backgammon has nothing hidden, and the host is
authoritative about every roll in any case.
## What the computer does
Not a search in the sense the chess and checkers players are one — there is no
tree to walk, because the opponent's reply depends on dice nobody has thrown
yet. Instead it weighs **whole turns**: every distinct way the roll can be
played, scored by the board it leaves behind.
Weighing turns rather than checkers is the point. A backgammon move is only good
in company — splitting the back checkers is right or wrong depending on what the
other die did — and a player choosing one checker at a time would never see it.
At the strongest level it also averages what the dice might do to it next: all
twenty-one distinct rolls, weighted properly (6-5 comes up twice as often as
5-5), taking the opponent's best answer to each.
The evaluation is built on the pip count, because backgammon is a race. Around
that: a blot is only a liability if it can be hit, so exposure is weighted by
how far away the nearest enemy checker is; a made point in your own home board
is worth having because it is one more number your opponent cannot come in on;
and a long run of consecutive points is what traps a checker behind it.