Chapter 1 · Game

Backgammon AI

← Chapter 1
Selected AI style: Balanced
Your browser does not support the canvas element.

How to play

  • Choose AI vs AI to watch two computer players, or Human vs AI to play. In Human vs AI you are White (you move from point 1 towards 24, and your home board is at the top right); the computer is Black.
  • When it is your turn to roll, click the board. Then click a checker to move it by the die shown as Next move in the side panel. Checkers with a legal move are marked with a yellow ring.
  • If both dice can be played from the same point, click the dice to swap their order.
  • Standard rules: hitting an opponent's lone checker (a blot) sends it to the bar; checkers on the bar must re-enter first; once all checkers are in the home board you may bear off. Both dice must be used if possible (all four on doubles); if only one can be used, the larger one must be played.
  • The side panel shows the dice left to play, the pip count (the total distance still to travel) and the checkers borne off.

How the three AI styles work

The AI does not use minimax. It computes a heuristic score for every legal move and picks the highest-scoring one. The chosen style only changes these heuristic weights, so you can see how the same legal-move generator produces different behaviour when the evaluation function changes.

ParameterRewards / penalizesAggr.Bal.Def.
BEAR_OFFBearing checkers off the board180020001900
HIT_OPPONENTHitting an opponent blot19001200700
MAKE_POINTMaking a point from your own lone checker300400850
COVER_BLOTCovering a blot / increasing safety180300700
LEAVE_BLOTPenalty for leaving a blot exposed−180−400−900
HOME_BOARDMoving a checker into the home board4060120
STACKING_PENALTYPenalty for stacking too many checkers on one point−20−40−70
RANDOMNESSSmall noise to break near-ties between moves30104

Aggressive

Strongly prefers hitting exposed opponent checkers and accepts more blot risk. It uses a larger random tie-breaker, so its play is less predictable.

Balanced

Very close to the original AI. It balances hitting, making points, protecting blots and bearing off without clearly favouring attack or safety.

Defensive

Strongly rewards making safe points and protecting exposed checkers. It heavily penalizes leaving blots and shows little interest in hitting unless the tactical gain is clear.

Important

Changing the selector does not affect a game in progress. Press Restart with style to start a new game with the new parameter set. In AI vs AI mode both sides use the selected profile. Mode menu stops the current game and shows the mode choice again.