
π² GNUBG for Python3
A downloadable tool
π² GNUBG for Python3
Advanced neural network backgammon evaluation engine, now in Python.
This project brings the full power of GNU Backgammonβs neural net evaluator into a modern Pythonic workflow, enabling game developers, researchers, and AI engineers to use state-of-the-art backgammon logic in their own applications.
π§ Features
-
π§ Neural Net Evaluation: Direct bindings to GNUBGβs six trained networks.
-
π² Best Move Finder: Get top plays with customizable ply-depths and move listings.
-
π Rollouts & Probabilities: Simulate thousands of games for accurate statistics.
-
π― Position Classification: Automatically detect race, bearoff, contact positions.
-
π‘ Resign Logic: Integrated resignation decisions based on win probability.
-
𧬠Equities Tables: Built-in support for GNUR, Snowie, Jacobs, and more.
-
π C-level Speed: Evaluations run via compiled C++ backend using Meson for fast builds.
π¦ Installation
pip install gnubg
Built for Linux, macOS, and Windows (via MinGW). Requires Python 3.8+.
π Usage Example
from gnubg import best_move, board_from_position_id board = board_from_position_id("4HPwATDgc/ABMA") # GNUBG Position ID dice = (3, 5) moves = best_move(board, *dice, n=2, s='X') print(moves)
Want to simulate match outcomes? Run rollouts or cube decisions using built-in methods like rollout()
and evaluate_cube_decision()
.
π¨βπ» Built With
-
C++ bindings via
pybind11
and Meson -
Direct port of GNUBG internals
-
Python 3 extension module
gnubg
with complete API coverage
βοΈ License
GNU GPLv2 — same as the original GNU Backgammon project.
π₯ Source Code & Contributions
π GitHub: github.com/reayd-falmouth/gnubg-nn-pypi
π PyPI: gnubg Β· PyPI
Contributions and PRs welcome!
Published | 1 day ago |
Status | Prototype |
Category | Tool |
Author | Dev Reay |
Tags | backgammon, Board Game, dev, library, python3 |