Hi Pixin,

For Pacman, you don't really need path finding as such. Traditional Pacman ghosts were always pretty dumb wandering aimlessly around the maze. So you don't have to worry about say A* pathfinding.

I've knocked together a really quick example of two ways you might go about doing it to try and give you some ideas. The two move routines 'move' and 'advMove' both have their flaws. The ghosts seem to stick around the outside of the maze. With the 'advMove' routine, you could change the weighting of the 'choices' the ghosts have by resizing the 'choices' array and adding the relevant directions to it. Thus, you could increase the chances of them taking a turn in the maze where one exists... this would help get them back into the center of the maze.

PacmanPathfindingExample.zip

To see the example in action, run the EXE, click the squares to create a maze (each click cycles from gray, dark gray, black and back again). When you're ready, click 'Launch Ghosts'.