home *** CD-ROM | disk | FTP | other *** search
-
- domains
- city=string
- kilo_meter=integer
-
- database
- distance(city,city,kilo_meter)
-
- predicates
- go
- get_input(string)
- first_comparison
- second_comparison
- print
- compare(integer,integer)
- comparison(string,string)
- /* store(integer)*/
-
- goal
- makewindow(1,7,7," ",0,0,25,80),
- go.
-
- clauses
- go:-
- consult("route.dat"),
- get_input(_),!,
- retract(distance(X,City,Length)),
- first_comparison,
- second_comparison,
- print,
- fail.
- get_input(X):-
- write("Enter starting point"),nl,
- readln(X).
- first_comparison:-
- distance(X,City2,Distance),
- compare(_,_),
- fail.
- second_comparison:-
- distance(City1,X,Distance),
- compare(_,_),
- fail.
- print:-
- !,
- distance(City1,City2,Length),
- comparison(_,_).
- compare(Length,Distance).
- /* Length>Distance,
- Store(_).
- Store(Distance).
- free(Length),
- Length=Distance.*/
- comparison(City1,City2):-
- City1=X,
- write(City2),
- free(X)σIASS1 BAK