Contents |
Introduction
This page illustrates the implementation of the so famous PacMan video game with the Jaak API.
The PacMan demo provides a possible implementation of the Ghost artificial intelligence.
The source code of this demo is embedded into a runnable jar that may downloaded at: PacMan. Just use
java -jar <jarname>in your beloved console to run this demo. Extract this jar to see the associated java source code and use
mvn clean installto compile it (assuming the use of Maven).
PacMan Video Game
The player controls Pac-Man through a maze, eating pills. Enemies (the Ghosts) are trying to catch Pac-Man. In this version of Pac-Man, the player cannot be killed by the ghosts. Ghosts are pursuing the Pac-Man when the player has not eaten a pill. In this case, the ghosts are fleeing the player.
Definition of the Environment
In PacMan, the environment is based on the Jaak grid. Each cell of the grid could contain one of:
- a wall,
- a empty cell which could contains a ghost, a pacman or a pill.
PacMan Applet
In the following applet:
- walls are blue;
- PacMan is yellow when it has not eaten a pill;
- PacMan is red when it has eaten a pill and this last is still active;
- Gray ghosts are moving randomly;
- Red ghosts are pursuing the PacMan;
- Green ghosts are fleeing the PacMan;
- White dots are the pill.
You are able to control the PacMan by clicking in the direction you want to move.
Download
Binary and Sources
pacman-1.0-20120518.220245-442-jar-with-dependencies.jar - 996 KB
Sources Only
pacman-1.0-20120518.220245-442-sources.jar - 33 KB


