Please load
knowledge base LINKS2. This is like LINKS, but instead of
describing just one straight chain, it describes a tree-like network.
As before, you have clauses for goes_to(X,Y)
if X leads to Y, but now
X may have more than one successor.
You also have clauses for weight(X,W)
, where X is a square and W is a
numerical weight associated with it. The idea is that squares with the
lowest weights define a preferred route. Your job is to write a
predicate like look
, but it has to take the lowest-weight successor at
each square.
This is not as hard as it sounds. First, assume you have a predicate
best(X,Y)
which, given square X, returns the lowest-weight successor
in Y. If you have this, you can easily write look
, just by copying the
code in the lesson.
So how do you write best
? Look back at the end of Supplement 6. This
should give you enough information.