Authors: @chiragvartak, @NeilFranks, @fmendoz7
The project page for this repository describes our approach in much more detail: Project page
If you want to understand how to train and run the agent, check out this video: Monte Carlo Pacman
All our code has been tested with Python 2 (2.7.18 to be precise). We do not use any version specific libraries so any Python 2 (>=2.7) should be fine.
-
You need to be present in the
multiagent/
directory to run all the commands below. -
(Optional) Train the Pacman agent by running the Monte-Carlo Tree Search simulations.
You can skip this step. In that case, the trained model we have included will be used for playing the games. Prefer running training games on thesmallStandard
. It is especially made for training.
python pacman.py --numTraining 10000 -q -p MCTSAgent -l smallStandard -n 10000
The trained model will be saved to models/model-latest.pkl
.
A robust model which has been well-trained has already been provided. It is named models/perfect-model.pkl
.
If you do not make any changes to the constants.py
config parameters. This model will be used as the base model, even
for the training, and for playing your games after that.
- Using a created model for playing games and then run your game:
python pacman.py --numTraining 0 -q -p MCTSAgent -l trickyFoodsFar -n 100
multiagents.py
- contains the MCTSAgent
which implements the Monte-Carlo Tree Search algorithm
featureBasedGameState.py
- feature-based representation of a game state
model.py
- storing, retrieving and using the generated model for playing games
search.py
- search algorthims from project 1 (A-Star search) are used to generate some features required for
game state representation
searchAgents.py
- the search problems present here are used for some feature extractions
layoutTransformer.py
- used to generate random layouts for performance analysis and debugging
We have provided varied layouts for you to try and see how the MCTSAgent
works:
testClassic
smallClassic
mediumClassic
bigClassic
trickyFoodsFar
openClassic2
franksClassic
openClassic