On the Subject of Ghost Movement
Who knew controlling ghosts was so complicated?
The module has four buttons representing each of the ghosts, and a submit button representing Pac-Man in the center, each button having a screen. The displays show the following information: their position in the maze (letter being the column from left to right, number being from top to bottom), and the direction they’re facing in the form of an arrow. Clicking each button changes the arrow on the button. Point each arrow in the direction each ghost will go in next (determined by the rules below) and then press the Pac-Man button to solve the module. If any arrow is pointed in a wrong direction, a strike will occur, with incorrect directions in red. Holding the Pac-Man button will reset the directions of the ghosts to their initial state.
Finding Target Tiles for each ghost
Blinky: The target tile is exactly where Pac-Man is located.
Pinky: The target tile is exactly four tiles in front of Pac-Man, with the exception of when Pac-Man is facing up, in that case the target tile is four tiles up and four tiles to the left of Pac-Man.
Inky: Find the tile two tiles in front of Pac-Man (and like Pinky, if Pac-Man is facing up, go two tiles up and two tiles to the left), this will be point X. Then, find the tile where Blinky is located. Rotate the point where Blinky is located 180° about point X. This is Inky’s target tile.
Clyde: If Clyde is more than eight tiles away from Pac-Man, the target is exactly where Pac-Man is located. Otherwise, The target is at tile 4531 (Marked with an orange C in the reference maze below).
If a target tile (that isn’t Clyde’s) or point X is in the red region (all tiles not shown in the reference maze are in the red region), change the target to the non-red tile which is the closest using Manhattan distance, the smallest number of orthogonal (up, left, down, right) steps needed to move between the two points.