Python scripts to analyze hanabi instances, providing interfaces to hanab.live, a local game database and analysis tools.
Find a file
Maximilian Keßler 967daf1914
Improve DB connection handling: Lazy init + config
Introduces a proper config file for db connection information
Also, connection now has to be explicitly initialized instead of this
being done on import: This is now done by the CLI function automatically
2023-07-05 20:54:26 +02:00
hanabi Improve DB connection handling: Lazy init + config 2023-07-05 20:54:26 +02:00
.gitignore clean up unneeded files, ignore test.py file 2023-07-05 19:02:09 +02:00
cheating_strategy add txt file with strategy 2023-05-25 17:00:53 +02:00
hanabi_cli.py fix bang in cli 2023-07-05 19:04:20 +02:00
LICENSE Add LICENSE 2023-07-05 17:31:23 +00:00
README.md update README 2023-07-05 20:49:58 +02:00
requirements.txt Improve DB connection handling: Lazy init + config 2023-07-05 20:54:26 +02:00

Hanabi-Suite

Disclaimer: This repository is still not in a good cleaned up code style, mainly due to me lacking time to clean stuff up properly. Do not expect everything to work, do not expect everything to be well-documented. However, I try to improve this from now on so that eventually, reasonable interfaces will exist so that this becomes actually more usable than now

What is this?

This is my personal attempt to write hanabi-related code to analyse and play around with the game. The main goals of the code are:

  • Provide an easy-to-use interface that supports all the variants available at hanab.live (some variants not supported yet)
  • Store data in a local database that mirrors (part of) the hanab.live database
    • This allows local analysis of a large sample of real-world hanab games played
    • It also allows us to store additional data for games / seeds etc, like: Is this seed theoretically winnable etc
  • Develop fast, exact algorithms to test for feasibility of instances
  • Develop bots that can play hanabi reasonably well, both for cheating and solitaire versions of the game
  • Have analysis tools for actual games played (from which turn onwords did we lose? What was the correct winning line in the end?)

Clearly, there is still much work to do, any contributions, suggestions etc are welcome

What is this good for?

Apart from the obvious use-cases for some features, I want to explore boundaries of the following questions:

  • What percentage of games is theoretically winnable, assuming perfect information? (solitaire play)
    • To answer this, we need fast, exact algorithms and run them on larg samples of seeds
  • What percentage of games is theoretically winnable by only looking at drawn cards, but not into the draw pile (cheating play)?

Alternative stuff that I would also like to try out eventually

  • Have some sort of endgame database, both for solitaire and cheating play
  • Develop certificates for infeasibility of hanab instances (I don't think the problem lies in coNP, but for real-world instances, most decks seems to have a short explanation on why they are not winnable)
  • Have analysis tools that can compute optimal moves in cheating play for endgame situations (and display winning percentages)
  • Analyse every seed on hanab.live for feasibility

Installation

Python

The hanabi folder is a working python package that you should be able to import if it's in your python path. You will need to install the requirements.txt as usual, I recommend setting up a venv:

python -m venv venv
source venv/bin/active
pip install -r requirements.txt

PostgreSQL

You need to install PostgreSQL on your system, for installation instructions refer to your distribution. Create a new database and user

Usage of stuff that already works:

Use the hanabi_suite.py CLI interface to download games and analyze them.