FIT5222 – Planning and Automated Reasoning
Assignment 2: Pacman – Capture the Flag (Rewritten Summary & Explanation)
This assignment requires the development of an AI controller for a multiplayer Capture-the-Flag version of Pacman. Two teams—Red and Blue—compete to steal food from the opponent’s territory while defending their own. The environment, originally created at UC Berkeley, presents a rich domain for automated planning and multi-agent reasoning. At the end of the semester, a competitive tournament will determine the strongest AI controller, with awards for the top three students.
1. Installation and Setup
Piglet PDDL Solver
You will use the piglet library for solving PDDL planning problems.
Steps:
- Navigate to the
piglet-publicdirectory (activate virtual environment if required). - Run
git fetch - Checkout the solver branch:
git checkout pddl_solver
This should makepddl_solver.pyavailable inlib_piglet/utils/. - Install the package:
python setup.py install
The simulator environment will use the same version of piglet for evaluation.
Pacman CTF Environment
Ensure your environment is up-to-date:
- Go to
pacman-public - Run
git fetch - Reset local edits if needed:
git reset --hard - Pull updates:
git pull - You should now see
staffTeam.pyandberkeleyTeam.pyin the repo.
All relevant game files are located within the pacman directory.
2. Game Overview
Pacman CTF has the following characteristics:
- Multi-agent: Two teammates coordinate against two opponents.
- Discrete: Grid-based map with discrete time steps.
- Dynamic: Food disappears when eaten.
- Partially observable: Agents see opponents only within 5 Manhattan units.
- Sequential: Choices affect future states.
- Deterministic: Outcomes depend solely on agent actions.
- Offline planning: The simulator halts while agents compute.
- Fully known rules: No hidden rules in the environment.
Game Map & Agent Roles
- The map is split into a red side (left) and blue side (right).
- A red agent becomes a Pacman when entering the blue side, and is a ghost on its own side.
- Goal: defend your own food while stealing food from the enemy.
Scoring Mechanism
- Eating food stores it in a temporary backpack.
- Returning to your side deposits all stored food → points scored.
- If caught by a ghost while carrying food:
- All food returns to its original locations.
- The agent respawns.
- No points are gained or lost by either team.
Power Capsules
- Allow a Pacman to turn enemy ghosts into “scared” mode for 40 time steps.
- Scared ghosts can be eaten.
Observation Model
- Opponents are visible only if within 5 Manhattan distance.
- Otherwise, agents receive noisy distance estimates (±6 units), without direction.
Win Conditions
A game ends if:
- A team steals all but 2 enemy food dots, or
- The 300-step limit is reached.
Winner = team with the most deposited food. A tied score is recorded as a draw.
3. Your Task & Workflow
Every time step, each agent receives the current game state. Your AI must:
- Choose a high-level goal
- Generate or reuse a high-level plan
- Generate or reuse a low-level plan
- Execute the next move
The entry point is the chooseAction function in myTeam.py.
3.1 High-Level Goals
Examples:
- Attack (invade enemy side)
- Defend (protect your food)
- Return home to score
- Chase an opponent
Modify the function getGoals to return appropriate PDDL goal descriptions.
You may create multiple goal types and choose between them based on current state, teammate status, or score dynamics.
3.2 High-Level Plan Generation
The function getHighLevelPlan uses piglet to compute a plan from PDDL state and goal descriptions.
Important design considerations:
- Should an agent reuse an existing plan?
- When should it replan?
- How does the agent respond to unexpected events (caught, new threats, teammate changes)?
You may enhance planning by:
- Adding richer predicates
- Adding new PDDL actions
- Improving domain modelling (in
myTeam.pddl) - Adding extra information from game state via
get_pddl_state
3.3 Low-Level Planning
High-level actions must be translated into concrete movements (north, south, east, west).
Implement this in getLowLevelPlan.
Possible approaches:
- Heuristic search (implement a custom expander class)
- Learning-based methods (improve the basic example provided)
- Custom strategies (evasion, opponent prediction, food clustering, capsule prioritisation)
You must also decide whether:
- To reuse old low-level plans
- To dynamically adjust based on new threats (e.g., a ghost unexpectedly appears)
You may design different low-level strategies for different high-level actions (e.g., chasing, defending, fleeing, food-seeking).
Team coordination is strongly encouraged.
3.4 Executing Moves
- The first move from your low-level plan is returned.
- After all four agents execute their moves, the world updates.
- The cycle restarts with a fresh state.
Compare your implementation against staffTeam.py and berkeleyTeam.py for debugging and benchmarking.
4. Competition System
Your AI will be evaluated against:
- The staff baseline (mandatory to beat)
- Other students’ agents (for victory points)
Each match runs 49 games across 7 maps.
Victory Conditions
- Win ≥ 28/49 → Convincing win → 3 victory points
- Lose ≥ 28/49 → 0 points
- Otherwise → Tie → 0.5 points
Your final score =
(Your total victory points) / (Maximum possible victory points)
Failing to convincingly beat the staff baseline = Fail for Competition Criteria.
5. Report Requirements
You must submit a technical report (max 15 pages) addressing:
- Your strategy
- High-level & low-level planning design
- Team coordination
- Algorithmic choices and justification
- Experiments, evaluation, results
- Strengths & weaknesses
- Relevant academic references
Font must be ≥12 pt (Times New Roman or Arial).
Markers stop reading beyond page 15.
6. Marking Rubric Overview
Implementation (50/75)
Assessed on:
- Competition performance
- Quality and originality of planning strategies
- Goal design
- Low-level planning
- Team coordination
- Extent of model improvements beyond baseline
Report (25/75)
Assessed on:
- Approach clarity and justification
- Experimental results and analysis
- Critical reflection
- Overall writing quality & organisation
- Supporting materials & references
7. Submission Instructions
Moodle Submission
Submit:
- Source Code
Folder namedsrczipped as:lastname_studentid_pacman.zip - Report PDF
lastname_studentid_report_pacman.pdf
Contest Server Submission
Required for marks. Submit early due to possible queueing or server issues.
Deadline: 3 November 2025, 11:55pm (Week 14).