Utilizing the Java framework provided by the pacman vs ghosts competition myself and a teammate wrote AI controllers for both the player and ghost agents. In order to control the player agent a state machine architecture was employed. The states defining player behavior were divided between keeping the player alive, by avoiding the ghost enemies, and seeking out remaining pellets on the game grid. The transition between these two strategies depended largely on the Euler distance between the player agent and ghosts, as the distance increased the player AI would increase its threat level and switch to its survival states. Once the threat level was low enough the player AI would then revert back to seeking out pellets.
The next page contains a sample of the controller and state machine classes used to direct the player agent.