9 breaking releases

Uses new Rust 2024

new 0.10.0 Nov 5, 2025
0.8.0 Aug 17, 2025
0.7.0 Jan 12, 2025
0.6.0 Aug 13, 2023
0.1.0 Dec 3, 2017

#131 in Game dev

Download history 105/week @ 2025-08-14 21/week @ 2025-08-21 2/week @ 2025-09-25 4/week @ 2025-10-02 89/week @ 2025-10-16 39/week @ 2025-10-23

134 downloads per month
Used in backgammon-simd

BSD-2-Clause

110KB
2K SLoC

Maintenance

backgammon

Backgammon: The Oldest Board Game in the World

This crate provides a pure, canonical implementation of the game Backgammon.

Supported Doubling Cube Rules

The following doubling cube rules are supported:

  • Beaver
  • Raccoon
  • Murphy
  • Jacoby
  • Crawford
  • Holland

Examples

Start a new backgammon match over the default number of points and with the default rules, as defined in Rules:

use backgammon::Match;

let mut m = Match::new();

Typically, you want to define the points for a match, hence:

use backgammon::Match;
use backgammon::rules::MatchRules;

let mut m = Match::new().
with_points(13);

Depending on the style of tournament you decide to play, it makes sense to select one or more rules too:

use backgammon::Match;
use backgammon::rules::{MatchRules, GameRules};

let mut m = Match::new();
m.with_points(13).unwrap();
m.with_jacoby().unwrap();

Play a game by calling:

use backgammon::Game;
use backgammon::rules::{Roll,GameRules};

let mut g = Game::new();

// roll dices
g.roll();

Design Philosophy

This library is designed to provide stateless Backgammon gameplay functionality. Because it does not track or store game states itself, you can easily implement wrappers that use this library along with an external database to manage and persist game states.

Discussions and Support

Remember that the APIs are not stable yet. Any support is very welcome. Please open an Issue to discuss features or ask for help.

License: BSD-2-Clause

Dependencies

~400KB