Backgammon - Single Player vs Bot (Full Rules) is a modern, fully responsive web game that brings a simplified yet rich version of the classic Backgammon experience to your browser. In this implementation, you play as “White” against a Bot (“Black”) following nearly complete rules—including hitting, the Bar for checkers, re-entry mechanics, and bearing off.
The project is implemented using HTML5, CSS3, and JavaScript. The game layout is split into three main parts:
- Two Bar areas (one for each player) on the sides.
- A central board divided into two rows (points 13–24 on top and points 12–1 on bottom).
The game logic enforces that if you have checkers on the Bar, you must re-enter them first before making any other moves.
Backgammon is a game of strategy and chance. This web version allows you to play a full (albeit simplified) version of Backgammon against a Bot. The game includes:
- Dice Rolling: Roll two dice (with doubles giving four moves) to determine movement.
- Checker Movement & Hitting: Move your checkers according to standard rules. Landing on a point occupied by a single opponent checker sends that checker to the Bar.
- Bar & Re-entry: If you have checkers on the Bar, you must re-enter them using the dice before other moves.
- Bearing Off: When all your checkers are in your home board, you can bear them off.
- Turn Management: The game automatically switches turns between you (White) and the Bot (Black), with on-screen indicators.
- Responsive Design: Works on both desktop and mobile devices with a modern dark-themed interface.
- Help Modal: Built-in Help instructions guide players through the rules.
-
Full Game Mechanics:
- Dice roll with doubles granting four moves.
- Legal moves calculation, including re-entry from the Bar.
- Hitting opponent checkers and sending them to the Bar.
- Bearing off when eligible.
-
Bot Opponent:
- The Bot selects random legal moves while respecting the rules regarding the Bar and hitting.
-
Responsive UI:
- Two Bar areas are displayed at the sides of the board.
- The central board is divided into two rows, clearly displaying all checkers.
-
Modern and Clean Design:
- Dark themed layout with smooth transitions and clear visual feedback.
-
Help Modal:
- A built-in Help section explains the rules and how to play.
- HTML5: Structure and semantic markup.
- CSS3: Styling, responsive design (with Flexbox and media queries), and modern UI transitions.
- JavaScript (ES6): Game logic, event handling, and state management.
-
Clone the Repository:
git clone https://github.com/bocaletto-luca/Backgammon.git
-
Start WebServer and open index.html in Web Browser
Starting a New Game: Click the New Game button to initialize the game with the standard Backgammon starting positions.
Rolling the Dice: Click Roll Dice to generate your dice values. The values show how many points you can move. If you roll doubles, you get four moves.
Click on a point that contains your checkers to move them.
If multiple moves are possible, a prompt will ask you to choose a die value.
If you have checkers on the Bar, you must re-enter them first using your dice.
Bot Turn: After you finish your moves, the Bot will automatically make its moves following the same rules.
Win Condition: The game ends when either you or the Bot bears off all 15 checkers.
Help: Click the Help button at the top right for detailed game instructions.