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
StatusPrototype
CategoryTool
AuthorDev Reay
Tagsbackgammon, Board Game, dev, library, python3