Pacman spends his life running from ghosts, but things were not always so. Legend has it that many years
ago, Pacman’s great grandfather Grandpac learned to hunt ghosts for sport. However, he was blinded by
his power and could only track ghosts by their banging and clanging.
In this project, you will design Pacman agents that use sensors to locate and eat invisible ghosts. You’ll
advance from locating single, stationary ghosts to hunting packs of multiple moving ghosts with ruthless
The code for this project contains the following files, available as a zip archive.
Files you’ll edit:
- bustersAgents.py Agents for playing the Ghostbusters variant of Pacman.
- inference.py Code for tracking ghosts over time using their sounds.
Files you will not edit:
- busters.py The main entry to Ghostbusters (replacing Pacman.py)
- bustersGhostAgents.py New ghost agents for Ghostbusters
- distanceCalculator.py Computes maze distances
- game.py Inner workings and helper classes for Pacman
- ghostAgents.py Agents to control ghosts
- graphicsDisplay.py Graphics for Pacman
- graphicsUtils.py Support for Pacman graphics
- keyboardAgents.py Keyboard interfaces to control Pacman
- layout.py Code for reading layout files and storing their contents
- util.py Utility functions
Ghostbusters and BNs
In this version of Ghostbusters, the goal is to hunt down scared but invisible ghosts. Pacman, ever
resourceful, is equipped with sonar (ears) that provides noisy readings of the Manhattan distance to each
ghost. The game ends when Pacman has eaten all the ghosts. To start, try playing a game yourself using
The blocks of color indicate where the each ghost could possibly be, given the noisy distance readings
provided to Pacman. The noisy distances at the bottom of the display are always non-negative, and
always within 7 of the true distance. The probability of a distance reading decreases exponentially with
its difference from the true distance.
Your primary task in this project is to implement inference to track the ghosts. For the keyboard based
game above, a crude form of inference was implemented for you by default: all squares in which a ghost
could possibly be are shaded by the color of the ghost. Naturally, we want a better estimate of the ghost’s
position. Fortunately, Bayes Nets provide us with powerful tools for making the most of the information
we have. Throughout the rest of this project, you will implement algorithms for performing both exact
and approximate inference using Bayes Nets. The project is challenging, so we do encouarge you to start
early and seek help when necessary.
While watching and debugging your code with the autograder, it will be helpful to have some
understanding of what the autograder is doing. There are 2 types of tests in this project, as differentiated
by their .test files found in the subdirectories of the test_cases folder. For tests of class
DoubleInferenceAgentTest , you will see visualizations of the inference distributions generated by
your code, but all Pacman actions will be pre-selected according to the actions of the staff
implementation. This is necessary to allow comparision of your distributions with the staff’s
distributions. The second type of test is GameScoreTest , in which your BustersAgent will actually
select actions for Pacman and you will watch your Pacman play and win games.
As you implement and debug your code, you may find it useful to run a single test at a time. In order to do
this you will need to use the -t flag with the autograder. For example if you only want to run the first
test of question 1, use:
python autograder.py -t test_cases/q1/1-ObsProb
EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!
E-mail: firstname.lastname@example.org 微信:easydue