A template for coding a pacman agent.
- Copy or clone the code from this framework to create your Pacman Agent, e.g.,
git clone [email protected]:aig-upf/pacman-agent.git
- Go into pacman-agent folder,
cd pacman-agent/
- Run
git submodule update --init --remote
to pull the last pacman-contest - Create a virtual environment, e.g.,
python3.8 -m venv venv
- Activate the virtual environment with
source venv/bin/activate
- Go to the pacman-contest folder and install the requirements:
cd pacman-contest/
pip install -r requirements.txt
pip install -e .
In the root folder do the following:
- Create in
my_team.py
a class with the name of your agent that inherits fromCaptureAgent
, e.g.class ReflexCaptureAgent(CaptureAgent):
- In the new class, override the
def choose_action(self, game_state):
function to return the best next action (check the given source code example). - (Optional) Add any other functions to the class for reasoning / learning and improving your agents decision which could also use other code sources in the same folder.
To debug the agent you can run capture.py
between the baseline_team
and your current agent:
cd pacman-contest/src/contest/
python capture.py -r baseline_team -b ../../../my_team.py