The game is a multi-player capture-the-flag variant of Pacman, where AI agents control both Pacman and ghosts in coordinated team-based strategies. Our team will try to eat the food on the far side of the map, while defending the food on our home side. For more info, click here
Our team (Level-256-UniMel18) won Finalist Award at Year 2018 Sem 2 Pacman Capture the Flag Inter University Contest
- Heuristic Search
- Monte Carlo Tree Search
- one offensive agent
- one defensive agent
Heuristic Search is an AI technique that use heuristic function to generate information based on the current state and the ranking for each actions of a given state
Our team leverages multiple heuristic functions to generate output as feature, and calculate overall ranking for the each actions
- isPacman: whether the agent has become Pacman
- ghostDistance: Distance to nearest ghost
- distanceToAvailableFood : Distance to nearest food, with no ghost on the way
- distanceToHome: Distance to the nearest point within our camp
- distanceToStart: Distance to starting point
- Eating food as much as possible
- Trying to eat the capsule and become more aggressive while opponent’s ghosts are scared
- Pacman has eaten a given amount of food and starts to go home in order to make sure the scores are firmly obtained
- The game is coming to the end (steps left are less than a given amount). Pacman starts to go home in order to boost the final score
- If the agent detects some of our food are eaten, the agent will go to the position of eaten food to search for enemy
- If the agent detects the incoming enemy, the agent will hunt the invading enemy
- If no enemy in sight and no food is being eaten, eat the food at the other side
Monte Carlo Tree Search allows us to simulate the future game states after taking a series of actions under a certain policy
When our Pacman's nearest food is inside a blocked area that has only one entry, we use simulation to see how many steps it would take for our Pacman to enter the blocked area, eat a certain amount of food and leave. Then the Pacman can decide how many food it would eat in the blocked area, without being blocked or eaten by ghosts. We simulated maximum 20 steps since a blocked area that takes more than 20 steps to walk around is dangerous enough for the Pacman to decide not to enter
- The provided function getmazedistance(pos1, pos2) only returns the length of the shortest path from pos1 to pos2, ignoring all other paths. However, in order to avoid enemies, our Pacman needs to take a longer path to get to its target. The goAround() function is designed to solve the problem by conducting a BFS from the current position to find a middle point whose shortest path to the target is clear
- Our defensive agent used to waste time chasing the opponent’s defensive agent that never eats food. To solve the problem, we keep a record of indexes of the opponent’s agents who has ever carried food. So that our defensive agent would only spend time defending those agents that would offend
- Defensive agent can perform better if it could predict the food the invading Pacman is going after and try to get in the way
- Eat capsules and opponents more wisely to maximize scare time
- Offensive agent’s path can be planned better to eat as many as food per step instead of always eating the closest food first
- After eating an opponent, its distance can be estimated using the knowledge of the opponents’ start point
- Adding the concept of time -> So the pacman knows how to choose more wisely when time is almost up
- Apply game theory to auto-switch between offender and defender.