The Mouse & Cheese Program



The Description

The object of the mouse and cheese program is to have a 'blind' mouse successfully find a hidden cheese in the least number of moves. This is done using what is known as heuristics, or an ordered search. The program uses a simple example of this, as the mouse determines the best way to move according to a set of rules. These rules instruct the mouse that it is for example, better to go to a new location, rather than one that has already been traveled. In this way the program demonstrates a simple tactic of artificial intelligence.

The mouse starts in the upper right corner of a 65 by 22 pen filled randomly with blocks. To move from his position, the mouse determines that it cannot go up or left (because of the walls) so it determines the next best move, which for this mouse is down. After the mouse moves, it re-evaluates its position, and decides on the next move that is best.

Most programming in AI is done using Lisp or Prologue. For this program however, since the example is basic, the documentation is in C++. The comments in the source code explain each procedure.


Jump to the source code in C++