View Full Version : Blinky, Pinky, Inky, and Clyde

07-11-2002, 05:33 AM
Does anyone know where I can find a good references on the various AI implementations of the ghosts in Pacman? Or if not have any suggestions on ways they might approach doing such AI? Here is a little of wait I'm aiming to achieve.

Ghost1 = Chaser -> main goal is to eliminate the player.
Ghost2 = Guardian -> main goal is to guard the pellets.
Ghost3 = Sentry -> main goal is to guard the area previously occupied by pelletes.
Ghost4 = Wanderer -> has no real goal, just wanders the map and chases the player if he gets too close.

07-11-2002, 09:08 AM
I'm sure that I have a usenet post sitting somewhere at home describing the basic algo. If I find it (it'll be at the end of today) then I'll chuck it up here. The AI is simpler than you'd think, IIRC (at least for the original pacman game).

07-11-2002, 10:39 AM
Perhaps not a specific implementation of pacman ai, but you might want to try amit's website (http://www-cs-students.stanford.edu/~amitp/gameprog.html). He has some excellent pathfinding material that helped me when I made my pacman clone in Java (http://www.a-rosendal.com/games/pacman/pacman.html).

07-11-2002, 08:53 PM
Yeah I want to make sure the AI is pretty decent. I really don't plan to speed the ghosts up each round to increase the difficulty, but rather have a set of AI for each ghost such that they do a good enough job not to need speeding up (if that made any sense). It's nice to finally get back on the horse here, this game has been sitting around waiting for an AI implementation for months now. Once that's done it's just a jump, hop, and skip away from a public beta test.

07-11-2002, 10:41 PM
Here's the basic algo - I found the usenet posting.

Disclaimer 1: This ain't mine
Disclaimer 2: It's not very advanced...

LSC wrote in message <8eu9t8$e3i$1@news4.jaring.my>...
>Hi all, can anyone lecture me what is the AI algorithm for pac-man?

I assume you mean the ghost movement:

1. Move in set direction.
2. When coming to a possible turn (not forced by dead end):
a. If Pac-Man is in the direction (on that same x/y) then
randomly decide to turn in that direction based on level.
b. Otherwise randomly decide to turn (10-20% is good).
3. At a dead end with multiple choices:
a. Never reverse direction.
b. Perform "good" turn from 2a.
c. Randomly pick if 3b fails to pick a direction.
4. Goto 1.

Hope this helps.


May help, may not...