MCPcopy Index your code
hub / github.com/carsten-wenderdel/wildbg

github.com/carsten-wenderdel/wildbg @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
454 symbols 955 edges 48 files 77 documented · 17% updated 2mo agov0.3.0-nets · 2025-08-06★ 5211 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

wildbg

wildbg is a backgammon engine based on neural networks. Currently, it's in alpha stage.

As of January 2024, it reaches an error rate of roughly 5.9 for 1-pointers when being analyzed with GnuBG 2-ply.

For discussions, please join the Discord Server Computer Backgammon Discord Shield.

Goals

  1. Provide source code and documentation to train neural nets from zero to super human strength.
  2. Implement logic to evaluate all kind of backgammon positions: cubeless and cubeful equities, multi-ply evaluation, rollouts, etc.
  3. Make the backgammon engine accessible via an easy-to-use HTTP JSON API.

A graphical user interface (GUI) is not part of this project.

Try it out

Bots on Backgammon Servers

bgammon.org

Thanks to @tslocum you can play against BOT_wildbg on his new backgammon server https://bgammon.org. No need to download a client or register.

The source code of the bot can be found here. There are also winning statistics available.

OpenGammon

On OpenGammon.org you can play against WildBG.

FIBS

Thanks to @oysteijo you can play against wildbg on the backgammon server FIBS. As FIBS client I recommend JavaFibs.

HTTP API

Online

You can access the API and see yourself how wildbg would move: https://wildbg-pwuo.shuttle.app/swagger-ui/

An example for the starting position and rolling 3 and 1: https://wildbg-pwuo.shuttle.app/move?die1=3&die2=1&p24=2&p19=-5&p17=-3&p13=5&p12=-5&p8=3&p6=5&p1=-2

Locally

Install Rust on your machine and then execute cargo run or cargo run --release. A web server will be started which you can access via http://localhost:8080/swagger-ui/

Beware that the networks committed to main branch of this repository are very small networks just for demonstration purposes. You can find the latest training progress and networks here: https://github.com/carsten-wenderdel/wildbg-training

Documentation

For users (bots and GUIs)

For contributors

Also see the CHANGELOG for a list of changes.

Acknowledgments

This project is inspired and influenced by other backgammon engines:

  • TD-Gammon by Gerald Tesauro brought the idea of using neural networks to backgammon
  • GnuBG - The strongest open source backgammon engine

Thanks to JetBrains for providing a free license for their IDEs via their Open Source Support Program.

Contributing

Help is more than welcome! There are some smaller tasks but also bigger ones, see https://github.com/carsten-wenderdel/wildbg/issues. Currently, most needed is: - Documentation of backgammon metrics / neural net inputs: https://github.com/carsten-wenderdel/wildbg/issues/4 - Proper cube handling: https://github.com/carsten-wenderdel/wildbg/issues/17

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

Evaluator (Interface)
[Evaluator] is one of the central parts of the engine. Implementing structs only have to implement the function [Evaluat [7 …
crates/engine/src/evaluator.rs
UnwrapHelper (Interface)
(no doc) [1 implementers]
crates/coach/src/unwrap.rs
DiceGen (Interface)
Implements all (pseudo) randomness that happens in wildbg. Example use case: rollouts. Not only dice rolls are implemen [3 …
crates/engine/src/dice_gen.rs
BatchEvaluator (Interface)
[BatchEvaluator] is a subtrait of [Evaluator]. The function [Evaluator::eval_batch] is implemented by default. This trai [2 …
crates/engine/src/evaluator.rs
InputsGen (Interface)
(no doc) [2 implementers]
crates/engine/src/inputs.rs

Core symbols most depended-on inside this repo

sides_switched
called by 29
crates/engine/src/position.rs
all_positions_after_mixed_move
called by 29
crates/engine/src/position/mixed_moves.rs
eval
called by 16
crates/engine/src/multiply.rs
clone_and_move_single_checker
called by 16
crates/engine/src/position.rs
can_move_when_bearoff_is_legal
called by 11
crates/engine/src/position.rs
equity
called by 11
crates/engine/src/probabilities.rs
router
called by 10
crates/web/src/axum.rs
all_positions_after_moving
called by 9
crates/engine/src/position.rs

Shape

Function 231
Method 157
Class 55
Enum 6
Interface 5

Languages

Rust93%
Python6%
C++2%

Modules by API surface

crates/engine/src/position.rs65 symbols
crates/engine/src/position/mixed_moves.rs37 symbols
crates/engine/src/probabilities.rs25 symbols
crates/engine/src/onnx.rs20 symbols
crates/engine/src/evaluator.rs19 symbols
crates/engine/src/dice_gen.rs19 symbols
crates/coach/src/rollout.rs19 symbols
crates/wildbg-c/src/lib.rs18 symbols
crates/web/src/axum.rs17 symbols
crates/web/src/web_api.rs15 symbols
crates/logic/src/wildbg_api.rs15 symbols
crates/engine/src/composite.rs15 symbols

For agents

$ claude mcp add wildbg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page