Navigation  without Java Scripts

The ancient myth of Theseus and Minotaurus illustrates the concept of backtracking in Prolog.

The Athenian hero Theseus had to find and kill the monster Minitauros in the maze of the Cretan emperor Minos. He used a ball of yarn, unrolling the string as he entered deeper and deeper into the maze. Every time he met a dead end, he was able follow his own track backwards (backtracking) to a branching spot and try another way. He found the monster and killed it, and found his way out of the maze.

Backtracking is the built in problem solving strategy of Prolog. When Prolog begins to look for a solution to a given problem or goal, it might have to decide between two or more possible candidates for the solution. It sets a marker at the branching spot (known as the backtracking point) and selects the first candidate to pursue. If that candidate fails (equivalent to reaching a dead end), Visual Prolog will backtrack to the backtracking point and try the next candidate (if there are any left). You can exploit backtracking as a way to perform repetitive processes as Visual Prolog will not only find the first solution to a problem, but is actually capable of finding all possible solutions.