Program(Queen Victoria's family):
On the query sister_of(X,Y) more one answer can be
returned. Explain how all the answers are obtained,
and what they are.
You are to write a simple program in Prolog to find a path through a maze. Your input will consist of facts of the form
pway(a, b, 10).
indicating that there is a passageway from intersection a to intersection b of length 10 meters. You are to write a rule
solve(X, Y, P, N) :- ...
that will find a path P of length N (if one exists) from intersection X to intersection Y. The intent is that the user will invoke solve as a query, specifying X and Y as constants and P and N as variables.
Here is a concrete example. Suppose the database contains the following rules:
pway(a, b, 10). pway(b, c, 15). pway(d, c, 5). pway(d, b, 10).
If the user types
solve(a, d, P, N)
the Prolog interpreter might respond with
P = [a, b, c, d] N = 30