Mini-Contest 1: Multi-Agent Pacman (due 2/11 11:59pm)
Table of Contents
In this mini-contest, you will apply the search algorithms and problems implemented in Project 1 to handle more difficult scenarios that include controlling multiple pacman agents and planning under time constraints. There is room to bring your own unique ideas, and there is no single set solution. Much looking forward to seeing what you come up with!
Extra credit points are earned on top of the 25 points available in P1. E.g. if you earn 1 point of EC through the mini-contest and had a 25/25 on P1, then you'll have 26/25 on P1
- 0.5 points per staff bot beaten in the final ranking
- 0.5 points for submitting a bot that scores more than 500 points on the leaderboard
Students that perform well in the final leaderboard will receive the following:
- 1st place: 2 points
- 2nd and 3rd place: 1.5 points
- 4th to 10th place: 1 point
Note: A good implementation of the bot in the "Quick Start Guide" below should easily score more than 500 points on the leaderboard.
Follow these 5 easy steps to quickly get involved in the contest!
- Download the code (
minicontest1.zip), unzip it, and change to the directory.
- Copy your
search.pyfrom Project 1 into the minicontest directory (replacing the blank
- Go into
myAgents.pyand fill out
AnyFoodSearchProblem. You should be able to copy your solutions from Project 1 over.
python pacman.py, and you should be able to see 4 pacman agents travelling around the map collecting dots
- Submit the
myAgents.pyfile to Mini-Contest 1 on Gradescope and see your ranking (Don't forget to give yourself a unique leaderboard name)! Note that it may take awhile for the autograder to run
Important! You only need to submit
myAgents.py. If you import from
the autograder will use the staff version of those files.
The base code is nearly identical to Project 1, but with some minor modifications to include support for more than one Pacman agent. You can download all the code and supporting files as a zip archive. Some key differences:
- You will control
NPacman agents on the board at a time. Your code must be able to support a multiple number of agents
- There is a cost associate with how long Pacman "thinks" (compute cost). See Scoring for more details.
|Files you'll edit:|
||What will be submitted to Gradescope. Contains all of the code needed for your agent|
|Files you might want to look at:|
||The same code as in P1, with some slight modifications|
||The same code as in P1|
||The main file that runs Pacman games. This file describes a Pacman GameState type, which you use in this project.|
Files to Edit and Submit: You will fill and submit
Evaluation: Your code will be autograded for technical correctness. Please do not change the names of any provided functions or classes within the code, or you will wreak havoc on the autograder. However, the correctness of your implementation -- not the autograder's judgements -- will be the final judge of your score. If necessary, we will review and grade assignments individually to ensure that you receive due credit for your work.
Academic Dishonesty: We will be checking your code against other submissions in the class for logical redundancy. If you copy someone else's code and submit it with minor changes, we will know. These cheat detectors are quite hard to fool, so please don't try. We trust you all to submit your own work only; please don't let us down. If you do, we will pursue the strongest consequences available to us.
Getting Help: You are not alone! If you find yourself stuck on something, contact the course staff for help. Office hours, section, and the discussion forum are there for your support; please use them. If you can't make our office hours, let us know and we will schedule more. We want these contests to be rewarding and instructional, not frustrating and demoralizing. But, we don't know when or how to help unless you ask.
Discussion: Please be careful not to post spoilers.
There are a variety of layout in the
layouts directory. Agents will be exposed to a variety of maps of
different sizes and amounts of food.
The scoring from Project 1 is maintained, with a few modifications
Kept from Project 1
- +10 for each food pellet eaten
- +500 for collecting all food pellets
- -0.4 for each action taken (Project 1 penalized -1)
- -1 *
total compute used to calculate next action (in seconds)* 1000
Each agent also starts with 100 points.
Each agent can see the entire state of the game, such as food pellet locations, all pacman locations, etc. See the GameState section for more details.
Winning and Losing
Win: You win if you collect all food pellets. Your score is the current amount of points.
Lose: You lose if your score reaches zero. This can be caused by not finding pellets quickly enough, or spending too much time on compute. Your score for this game is zero. If your agent crashes, it automatically receives a score of zero.
You should include your agents in a file of the same format as
myAgents.py. Your agents must be
completely contained in this one file. Though, you may use the functions in
pacman.py should look familiar, but contains some modifications to
support multiple Pacman agents. The major change to note is that many
now have an extra argument,
agentIndex, which is to identify which Pacman agent it needs. For example,
state.getPacmanPosition(0) will get the position of the first pacman agent. For more information,
GameState class in
To get started designing your own agent, we recommend subclassing the
Agent class in
game.py (this has already been done by default). This provides to one important variable,
which is the
agentIndex of the current agent. For example, if we have 2 agents, each agent will be
created with a unique index,
[MyAgent(index=0), MyAgent(index=1)], that can be used when deciding on
The autograder will call the
createAgents function to create your team of pacman. By default, it is
set to create
N identical pacmen, but you may modify the code to return a diverse team of multiple
types of agents
By default, the game runs with the
ClosestDotAgent implemented in the Quick
Start Guide. To run your own agent, change
agent for the
A wealth of options are available to you:
python pacman.py --help
To run a game with your agent, do:
python pacman.py --pacman myAgents.py
layouts folder contains all of the test cases that will be executed on the autograder. To see
how you perform on any single map, you can run
python pacman.py --layout test1.lay
You can run you agent on a single test by using the following command. See the
layouts folder for
the full suite of tests. There are no hidden tests
python pacman.py --l test1.lay
You can run the autograder by running the command below. Your score may vary from the autograder due to differences between machines, as well as staff vs student search implementations.
python autograder.py --pacman myAgents.py