
# backgammon
## Backgammon: The Oldest Board Game in the World
This crate provides a pure, canonical implementation of the game
[*Backgammon.*](https://en.wikipedia.org/wiki/Backgammon)
<img src="https://upload.wikimedia.org/wikipedia/commons/3/30/Backgammon_lg.png" height="100">
### Supported Doubling Cube Rules
The following doubling cube [`rules`](`crate::rules::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`](`crate::rules::Rules`):
```rust
use backgammon::Match;
let mut m = Match::new();
```
Typically, you want to define the points for a match, hence:
```rust
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:
```rust
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:
```rust
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](https://codeberg.org/Backgammon/backgammon/issues) to discuss features or ask for help.
License: BSD-2-Clause