Quote Originally Posted by Squize
If playerXPos<ghostXPos then the ghost's preferred horizontal move is left, and if playerYPos>ghostYPos then the best vertical direction for it is down.
This is basically my implementation of Pacman pathfinding, with 4 enemies, it got really hard to avoid them.

If you feel like sprucing it up a bit, make a couple work like this, and then a couple work simply by going a random direction. Adds some zest