Backgammon against the computer

Play backgammon online against the computer: dice, judgement and a race to bring your checkers home. Free, no sign-up, in the browser.

What this game is

Backgammon is the one classic game where dice and calculation live together as equals. You do not choose the roll, but you choose how to play it, and the whole game hides inside that choice.

On the surface it is a race: fifteen checkers have to travel round the board and come off before your opponent's do. In practice, for most of a game the two armies walk into each other and make life difficult. A lone checker can be hit and sent back to the start, and a wall of made points can lock an opponent up for several turns. Hence the decision behind almost every move: run, or keep contact.

Rules

How to play better

A bit of history

Backgammon is one of the oldest board games still being played. Races along a track of squares decided by dice go back thousands of years; the Romans had their own version, and medieval Europe a whole family of games known collectively as tables. The modern rules are a late cast of that long tradition.

What made the game modern was a twentieth-century invention. In the 1920s the doubling cube appeared in New York: on your turn you may offer to double the stake, and your opponent must either accept or resign on the spot. Exactly who thought of it is not reliably known. The cube turned backgammon from a folk race into a game about estimating your own chances as a percentage — there is no cube here, so every game is played to the end.

In 1992 the game went through another revolution. Gerald Tesauro's TD-Gammon at IBM learned to play by playing itself a million and a half times: it was given the rules and no human knowledge of strategy at all. At its public debut it barely lost to the strongest players in the world, and its opening moves were so unexpected that professionals rewrote their opening theory.

This version follows the applet that ran on this site from 2005. Gammons and backgammons are recognised and announced, but the site-wide score is a simple one and any win is worth the same in it.

About the levels

On every turn the computer first builds every legal way to play the roll out in full — honouring both "play both dice" and "if only one, the larger" — and then chooses among the resulting positions. The level decides how deeply it checks them.

Easy judges a position by eye and fast: the pip difference, checkers on the bar and borne off, a penalty for its own blots and a small bonus for a blot you left behind. There is no looking ahead at all, which is why it happily leaves checkers where they can be hit.

Hard genuinely searches one ply. It takes the twenty best positions by static score and, for each, runs through all 21 distinct rolls of your reply — a double weighs 1/36, any other pair 2/36 — finds your best answer to each roll and averages the results. So the move is chosen not by how the position looks but by what it becomes on average after any die.

Expert does the same thing two plies deep: twenty candidates get a one-ply value, the best eight get a two-ply one in which the average over all 21 rolls is followed by another full average for the other side. It is given a budget of roughly eight tenths of a second for all that. On top of it, once the two armies have run past each other and nothing can be hit any more, Expert switches to a pure racing evaluation: pips plus wastage, the checkers piled up or buried on the near points that have nothing to do with a big number.

Hard and Expert value a position the same way: pips, made points, the home board, an anchor in the enemy home, the prime (which grows as the square of the chain), penalties for the bar and for an overloaded point, and above all the risk on every blot — the chance of being hit next roll, computed from a table of how many of the 36 rolls cover exactly that many pips.

Where to go from here