Theseus and the Minotaur's Maze

JavaScript example by Simon Krix

A HTML 5 compatible browser is required.

Theseus is trapped in the Minotaur's Maze and must find the exit. He can move one square left, right, up or down, or remain still for one move. But each time Theseus moves, the Minotaur makes two moves. For each of the Minotaur's moves, he always moves toward Theseus horizontally if he can, or vertically otherwise.

This example JavaScript program finds the solution to this puzzle using a breath-first search algorithm. It is guaranteed to find an optimal solution (smallest number of moves) and does so in just under a thousand steps.

You can view the source code for this example.