Test your definition by asking a variety of queries, with different combinations of bound and unbound arguments.
(Getting this to work with the number bound, greater than 1, and one or both of the actors unbound is tricky; let's call it extra credit.)
What happens if you ask about the "distance" between two actors who have two different connections, e.g. they appeared in two movies together, or they have both a degree-two connection and (through different movies and people) a degree-three connection? What do you think should happen in such situations?
Extra credit: When people play "six degrees of Kevin
Bacon", it's not good enough to say "Joe Schmoe is 4 degrees away from
Kevin Bacon"; you have to prove it by giving a path
from Joe Schmoe to Kevin Bacon, naming all the actors and movies along
the way.
Write a predicate named path/3
that works like degrees/3, except that its third argument is
bound to a list rather than a number. For example,
path(harrison_ford,kevin_bacon,Path).
might return the answerPath = [harrison_ford,star_wars,carrie_fisher,blues_brothers,john_belushi,animal_house,kevin_bacon]
Build several example binary search trees, ranging from 0 to at least eight nodes. (You can memorize these in the rule database, e.g. by asserting a fact example_BST/1 with the tree as an argument; then you can later test all your examples easily by asking example_BST of an unbound variable.)
Test your definition by asking a variety of queries, with various combinations of bound and unbound arguments, about several example binary trees, searching for nodes that are at the root, that are higher up the tree, and that are not in the tree at all. Trace through a sample execution or two to confirm that it inspects all the nodes in the tree until it finds the right one (if it exists).
Test your definition by asking a variety of queries. Trace through a sample execution or two to confirm that it's only looking at a few nodes, not every node in the tree.
Test your definition by inserting several nodes in succession into a BST and checking that the result has all the right nodes in the right order.
Test your definition on several different lists.
The assignment may be done in teams of two students, working together at one workstation much or all of the time. Each team should turn in one copy of the homework with both names on it. If more than two people turn in essentially the same program, I will consider it cheating and they will all be penalized, as stated in the syllabus.