
#const n=6.      

%%%%%%%%%%%%%%%%%%%%  SCENARIO 3 %%%%%%%%%%%%%%%%%%
%                                                 %
%     John took the plane from Paris to Baghdad.  %
%     On the way the plane stopped in Rome.       %
%     Where is John?                              %
%                                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% This only differ from scenario 2 by the query.
% This time, we want to know which elements of
% a class of fluents are true at the current
% state of the domain.


%           THE TRANSLATION
%     John took the plane from Paris to Baghdad. 

            h(at(john,paris),0).
            o(go_on(john,j(paris,baghdad)),0).

%     On the way the plane stopped in Rome. 

            o(stop(j(paris,baghdad),rome),2).

% Query: 
% The test to check for which values of C the
% query is satisfied is written by defining
% predicate answer_true with the name of the
% query as argument. Since variables are
% involved, the name of the query is a term
% of the form q(V1,...Vn), where V1,...,Vn
% are the variables whose values the query
% is requesting.
%
answer_true(q(C)) :-
		h(at(john,C),n).
type_query(q(C),find).   

% Note the use of variable C for cities
% (used by the travel module as locations) 
% In general we need a properly typed variable.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% To run the new query we'll use the rules:


ans(Q) :-
       type_query(Q,find),
       answer_true(Q).

% and the display directives:

hide.

show ans(A).

