This is a program that plays Hanabi.
A sample (stupid) AI is provided in the directory dummy.
Here are the average scores and win rates for the standard 50-card deck (5 colors) and for the "black" 55-card variant (6 colors, where the 6th color has 1 copy of each card).
Average scores
Win rates
- Python >= 3.7
- The
termcolorPython module (install command:pip install termcolor) - The
blessingsPython module (install command:pip install blessings)
python run_game.py
Command line options
-n NUM_PLAYERSset number of players (default is 5)-a AI_DIRECTORYchoose AI (default isalphahanabi)-p DIFFICULTYchoose difficulty level foralphahanabi(possible values:moderate,hard,hardest; default ishardest)-crun the game without pausing (otherwise, by default, each new turn is played by pressing ENTER)-sactivate the strategy log-tprint a shorter log of turns and status-l FILE_NAMEload the initial deck from the given file (otherwise, by default, the initial deck is shuffled randomly)-d FILE_NAMEdump the initial deck to the given file (default isdeck.txt)-r SCORErun many games, until a score <= to the given score is reached-irun in interactive mode-qquit immediately after showing the initial cards (not in interactive mode)
python test.py
or (much faster)pypy test.py
Command line options
-n NUM_PLAYERSset number of players (default is 5)-m NUM_GAMESset number of games (default is 1000)-a AI_DIRECTORYchoose AI (default isalphahanabi)-p DIFFICULTYchoose difficulty level foralphahanabi(possible values:moderate,hard,hardest; default ishardest)-d DECK_TYPEchoose deck type (possible values:standardfor the standard 50-card deck,blackfor the 55-card deck)
First run, saving the deck and seeing the cards:
python run_game.py -d FILE_NAME -q
Second run, loading the deck and running the game without showing cards:
python run_game.py -l FILE_NAME -p DIFFICULTY -t -i