Retro Game Mechanics Explained generally does interesting videos, I find. The details on how the ghosts (monsters) in Pac-Man behave when dangerous are fairly well understood now, thanks to the work of Jamey Pittman in writing The Pac-Man Dossier. RGMEx did a summary video of that work three years ago.
The question of how vulnerable ghosts move, after Pac-Man has eaten a Power Pellet (Energizer), isn’t covered in as much detail. It’s still as accurate as the rest of the information in the document, but its implications are left for the reader to explore. Well, RGMEx has explored it.
Vulnerable ghosts move pseudo-randomly, through an interesting process. The game has a RNG (random number generator) that’s reset at the start of every level, that cycles through a period of 8,192 values. Vulnerable ghost movement is the only thing in the game that it’s used for, but it isn’t applied directly. Instead, it’s used as a pointer into the game’s own code, and the value of the address it finds is used to determine how the ghost moves.
A result of this is that not all directions are chosen equally. But further, and more importantly, if the direction chosen isn’t available, the ghost tries the next direction in a clockwise order. If that one’s not possible, it tries the next, until it finds one that works.
These two facts combine to give a definite bias to the directions that frightened ghosts move. Retro Game Mechanics Explained then ran the numbers and figured out where scared ghosts tend to go. It’s interesting, even slightly useful, information.