tic-tac-toe Monte Carlo Tree Search
How to install package depenencies.
- Python >= 3.7
pip install -r requirements.txt- empty game
- initial state (
--ini-game assignment):
--n-rolloutsis number of rollouts per Monte Carlo Tree Search interation (aka computational budget)--ini-gameempty or assignment--verboseoptional flag to increase number of logs
python main.py --n-rollouts N_ROLLOUTS --ini-game {empty,assignment} [--verbose]For example: bash
python main.py --n-rollouts 10 --ini-game assignment
Possible output
x plays with MCTS
Initial game:
_ o x
_ x _
o _ _
Player 'x' moved to (1,2)
_ o x
_ x x
o _ _
Player 'o' moved to (2,1)
_ o x
_ x x
o o _
Player 'x' moved to (1,0)
_ o x
x x x
o o _
Winner: x
To run the script N times you can use the test.py and plot.py scripts.
test.pyruns main.py with dirrerent parameters and pickles resultsplot.pyloads test results and create plots
python test.py
python plot.py





