Endgame-Analyzer/README.md
2023-09-06 12:02:08 +02:00

45 lines
2.2 KiB
Markdown

# Endgame-Analyzer
This is a dynamic program written in C++ to solve Hanabi endgames.
Some optimizations are performed, but it is not particularly well-written at the moment and could also use some code cleanup.
As of now, you can run the executable with an id from a hanab.live game and a turn number (shifted by 1, since we start counting at 0 and hanab.live at 1) and the winning
percentage for the corresponding game state with optimum play will be calculated.
Here, optimum play refers to the assumption that everbody knows their cards, but not the draw pile.
For example, if the output of the program is 1, then this means that even if an evil adversary is allowed to pick the next card in the deck each time a card is drawn, there is still a strategy that guarantees a win.
## Compilation
The build uses [CMake](https://cmake.org). Additionally, you need the following libraries:
- [boost](https://www.boost.org): For some faster containers and JSON parsing
- [cpr](https://libcpr.org): For easy requests (to download games from [hanab.live](https://hanab.live)
- [GNU readline](https://tiswww.cwru.edu/php/chet/readline/rltop.html): For the command-line interface.
Refer to the corresponding pages for installation instructions. On Linux distributions, readline is probably already installed.
Note that the libraries are all FOSS software and GPL-compatible.
Now, building the project is quite easy:
```
cmake -DCMAKE_BUILD_TYPE=RELEASE . // Release build recommended for performance, unless you want to develop
make // Rerun this every time you change sources
```
## Usage
```
# ./endgame-analyzer (GAME_ID | GAME_FILE) TURN
```
where
- `GAME_ID` is a game from hanab.live.
- `GAME_FILE` is a path to a file containing the game as JSON in the hanab.live format.
- `TURN` specifies the turn of the game state to analyze. Turn 1 is the state before actions have been taken.
Be cautious about specifying too low turn counts, your program will eventually run out of memory.
Typically, turn counts where roughly 8 cards are still in the draw pile are reasonably fast,
but running times depend heavily on the exact game state you want to analyze.
## License
This is GPLv3-licensed. See [LICENSE](./LICENSE) for details.