$=

Examples

Concluding our discussion of Prolog, two examples will be given that will illustrate how to use Prolog for implementing search in a finite search space. The first example presents a solution to a problem in chess, the N-queens problem. Our solution is given for
N = 8, but may be easily generalized to other values of N. The second example illustrates depth-first search with a loop-check built-in to prevent non-termination. .so queens states