Procyon at 10/27/2008 16:06
I wish I found this sooner... there are some discrepancies in the analysis of the ghosts behavior. The algorithms used to control the ghosts have all been found and decoded. They are actually really quite simple (except for Inky/Bashful.) I described it all in detail over at StrategyWiki. They work like this:
Blinky/Shadow: When the ghosts are not patrolling their home corners, Blinky will attempt to shorten the distance between Pac-Man and himself. If he has to choose between shortening the horizontal or vertical distance, he will choose to shorten whichever is greatest. For example, if Pac-Man is 4 grid spaces to the left, and 7 grid space above Blinky, Blinky will try to move up before he moves to the left.
Pinky/Speedy: When the ghosts are not patrolling their home corners, Pinky wants to go to the place that is four grid spaces ahead of Pac-Man in the direction that Pac-Man is facing. If Pac-Man is facing up, Pinky wants to go to the location exactly four spaces above Pac-Man. He does this following the same logic that Blinky uses to find Pac-Man's exact location.
Inky/Bashful: Bashful has the most complicated AI of all. When the ghosts are not patrolling their home corners, Bashful considers two things: Shadow's location, and the location two grid spaces ahead of Pac-Man. Bashful draws a line from Shadow to the spot two squares in front of Pac-Man, and extends that line twice as far. Therefore, if Bashful is alongside Shadow when they are behind Pac-Man, Bashful will usually follow Shadow the whole time. But if Bashful is in front of Pac-Man when Shadow is behind him, Bashful tends to want to move away from Pac-Man (in reality, to a point very far ahead of Pac-Man).
Clyde/Pokey: Pokey has two basic AIs, one for when he's far from Pac-Man, and one for when he is near to Pac-Man. When the ghosts are not patrolling their home corners, and Pokey is far away from Pac-Man (beyond 8 grid spaces), Pokey behaves very much like Blinky, trying to move to Pac-Man's exact location. However, when Pokey gets within 8 grid spaces of Pac-Man, he changes his behavior and goes to his home corner in the bottom left of the maze.
