Attacker - PrincekinNicholas/PacMan-AI-Planning GitHub Wiki

Introduction

In our project, we created an agent for attacking and this agent completes its offensive tasks. It will automatically find the optimal path to the task point through the A* algorithm. At the same time, the attacker agent will change its target in some cases.

Strategy

Dead End Map
At the beginning, our agent will learn the contest map and make a matrix for the Dead End Map. In this matrix, if the value of the cell is -1, it means that there is a wall. If the value of the cell is 0, it means that this is a normal road which is not a dead end. If the value is a positive number, it means there is a dead end, and the number is that how depth this dead end is. For example, as shown in the figure below, dead-end cells may have different values only if their depth is different.

The default contest map DeadEndMap The related Dead-End Map relatedDeadEndMap

Avoid Ghost
If the attacker can observe an opponent ghost, we will remove the action which leads me to the ghost from the legal action list at my current position. And also we will remove the action which leads me going to dead end if I am currently avoiding ghost
Safe Food List
We have 2 different food list. they are called the safetyFood list and the foodList. The foodList includes safety foods and dangerous foods which is in the dead-end map. However, the safety food list includes all foods which are not in the dead-end map. If we are currently avoiding ghost, we will only eat the safety foods and carry them back to our side.
Chasing New Target
There's 2 types of action mode. If the agent can't observe the opponent ghost, which means it is in a relatively safe situation. The Pacman will chase after the food by the descending order.
If the agent can observe the opponent ghost, the Pacman is automatically transferred to alert mode. The action he made is set to avoid ghost while chasing food. This means from now, the Pacman won't eat any food located in a dead end. If the safe food is already eaten up, the Pacman will check whether he is carrying food. If he's carrying food, the new process is to return home. Otherwise, the Pacman will decide to eat the capsule, if it exists. On the other hand, if it couldn't find a proper decision, the Pacman will run for life, until it finds a new target.

ChasingTarget

⚠️ **GitHub.com Fallback** ⚠️