Coder Social home page Coder Social logo

jeizsm / backgammon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carlostrub/backgammon

0.0 0.0 0.0 187 KB

Backgammon library written in Rust

Home Page: https://crates.io/crates/backgammon

License: BSD 2-Clause "Simplified" License

Shell 1.94% Rust 98.06%

backgammon's Introduction

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 rules on the doubling cube are supported:

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

Examples

Start a new backgammon match over the default amount 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().
with_points(13).
with_jacoby();

Play a game by calling:

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

let mut g = Game::new();

// set rules
g = g.with_beaver().with_raccoon().with_murphy(3).with_jacoby().with_holland();

// roll dices
let g = g.roll();

Design Philosophy

This library is designed to offer completely stateless game functions. This means that it should be easy to implement wrappers using this library in combination with some databases to store the game state.

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.

You can also find me on:

IRC: #backgammon @ libera.chat (via webchat)

License: BSD-2-Clause

backgammon's People

Contributors

carlostrub avatar jeizsm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.