/hex-rl

Implementation of an End-to-End Reinforcement Learning Framework for Hex Strategy Optimization with Command-Line and Graphical User Interfaces

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Implementation of an End-to-End Reinforcement Learning Framework for Hex Strategy Optimization with Command-Line and Graphical User Interfaces

Bachelor Thesis at Hanoi University of Science and Technology by Hoang Tran Nhat Minh (20204883)

GitHub repository: https://github.com/htnminh/hex-rl

How to run

Install all dependencies:

pip install -r requirements.txt

Generate models (optional):

DQN models are provided in the model directory. However, if they are not available, they should be generated for the first time, or the only available "AI" is the random agent.

mkdir model
python hex_rl/model_dqn.py

Play a Hex game:

python hex_rl/tk_mainmenu.py

(CLI) Play a Hex game in PvP mode with board size 7x7:

python hex_rl/hex_cli.py play pvp --size 7

(CLI) Show help message:

python hex_rl/hex_cli.py --help

Notes

The project is implemented and tested on Python 3.11.7, and should work on newer releases.

All commands are tested on Windows. python should be replaced with python3 on most Linux distributions.

License

This project is licensed under the GNU General Public License v3.0.

Developer notes

Install pylint and graphviz then run to visualize (sometimes pylint doesn't work well with anaconda, reinstalling pylint via pip is the current best resolution):

pyreverse hex_rl -s 1 -A -m y --colorized
dot -Tsvg classes.dot -o classes.svg
dot -Tsvg packages.dot -o packages.svg

requirements.txt is generated by pipreqs.

Code of Conduct