In this assignment, you will design agents for the classic version of Pacman, including ghosts. The code base has not changed much from the previous Pacman assignment, but please start with the attached multiagent.zip, rather than intermingling files from the previous Pacman assignment.
Files youll edit: | |
multiAgents.py | Where all of your multi-agent search agents will reside. |
Files you might want to look at: | |
pacman.py | The main file that runs Pacman games. This file also describes a Pacman GameState type, which you will use extensively in this assignment. |
game.py | The logic behind how the Pacman world works. This file describes several supporting types like AgentState, Agent, Direction, and Grid. |
util.py | Useful data structures for implementing search algorithms. You dont need to use these for this assignment, but may find other functions defined here to be useful. |
Supporting files you can ignore: | |
graphicsDisplay.py | Graphics for Pacman |
graphicsUtils.py | Support for Pacman graphics |
textDisplay.py | ASCII graphics for Pacman |
ghostAgents.py | Agents to control ghosts |
keyboardAgents.py | Keyboard interfaces to control Pacman |
layout.py | Code for reading layout files and storing their contents |
Welcome to Multi-Agent Pacman
First, play a game of classic Pacman by running the following command:
python pacman.py
and using the arrow keys to move. Now, run the provided ReflexAgent in multiAgents.py
python pacman.py -p ReflexAgent
Note that it plays quite poorly even on simple layouts:
python pacman.py -p ReflexAgent -l testClassic
Inspect its code (in multiAgents.py) and make sure you understand what its doing.
Task: Reflex Agent
Improve the ReflexAgent in multiAgents.py to play respectably. The provided reflex agent code provides some helpful examples of methods that query the GameState for information. A capable reflex agent will have to consider both food locations and ghost locations to perform well. Your agent should easily and reliably clear the testClassic layout:
Experiment 1:
python pacman.py -p ReflexAgent -l testClassic
Experiment 2:
Try out your reflex agent on the default mediumClassic layout with one ghost or two (and animation off to speed up the display):
python pacman.py frameTime 0 -p ReflexAgent -k 1 python pacman.py frameTime 0 -p ReflexAgent -k 2
How does your agent fare? It will likely often die with 2 ghosts on the default board, unless your evaluation function is quite good.
Reviews
There are no reviews yet.