This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/lo/planner/city.lgt
vsc fd048651b6 Logtalk files
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@55 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
2001-06-06 20:07:01 +00:00

31 lines
452 B
Plaintext

:- object(city).
:- public(step/3).
:- mode(step(+, +, -), zero_or_more).
:- public(airport/1).
:- mode(airport(?atom), zero_or_more).
step(X, Y, P1-P-P2) :-
\+ same_city(X, Y), !,
X::airport(XA),
Y::airport(YA),
plan(fly)::from(XA, YA, P),
plan(city)::from(X, XA, P1),
plan(city)::from(YA, Y, P2).
step(X, Y, taxi(X, Y)) :-
same_city(X, Y),
X \= Y.
same_city(X, Y) :-
X::airport(A),
Y::airport(A).
:- end_object.