This is the most complicated part of Pacman. Ghosts need to find a path to the player and also the four ghosts have different movement patterns.