Visual Prolog is a good tool also in planning and rapidly making game prototypes and inspecting different algorithms.

 

Pacman

 

A Pacman type game, where the monsters are chasing the player in a labyrinth has to use a route finding (search) mechanism in order to catch efficiently the player. Finding the route between two points in a complex labyrinth is the core of a game of this kind. In a big labyrinth to calculate the shortest path demands much counting power.

 

There are several possible path finding or search algorithms:

 

Every search algorithm uses rather much computer resources with a larger data. In this Pacman game is used A* algorithm which provides an efficient way to locate the target. More information about Astar can be found via this link.

 

This game example creates when started three monsters in random places of the labyrinth. The monster has a radar (1-10 step) meaning the length of time interval when searching the path to the goal (=player) is updated. Short radar means that the path is calculated more often. The radar is implemented to save counting power and give a better change to the player to finish the game. The speed of monsters increases by 20 percent every 15 seconds.

 

It would be relative simple to program rules to make the monsters more intelligent so, that they hunt as a heard using a more complex strategy than only chasing all behind the player. For example so that only one chases the player and the others wait in strategic positions for the player to come nearer.

 

Increasing the intelligence of the monsters I leave to those who get interested in making this example program more developed.

 

The moving is done with the cursor moving keys.

 

 

Snake game

This game is the traditional snake game familiar from many mobile phones. The moving is done with the cursor moving keys.