代写代考 :- dynamic at/3, hasLander/3,fullStore/2,hasAnalysis/4.

:- dynamic at/3, hasLander/3,fullStore/2,hasAnalysis/4.
/* This is necessary if rules with the predicate at(R,L,S) in the head are
not consecutive in your program. Each non-consecutive predicate
should be declared as dynamic.

Copyright By PowCoder代写 加微信 powcoder

solve_problem(N,L) :- C0 is cputime,
max_length(L,N),
reachable(S,L), goal_state(S),
Cf is cputime, D is Cf – C0, nl,
write(‘Elapsed time (sec): ‘), write(D), nl.
max_length([],N) :- N >= 0.
max_length([_|L],N1) :- N1 > 0, N is N1 -1, max_length(L,N).
reachable(S,[]) :- initial_state(S).
/* This recursive rule is for the regular part of the assignment */
reachable(S2, [M|List]) :- reachable(S1,List),
legal_move(S2,M,S1).

/* The following rule is for the bonus question only: remove comments
and write your own rules to implement the predicate useless(Action,List).
% reachable(S2, [M | ListOfActions]) :- reachable(S1,ListOfActions),
% legal_move(S2,M,S1),
% not useless(M,ListOfActions).

legal_move([A|S], A, S) :- poss(A,S).
initial_state([]).

/************ Precondition axioms ****************/
% Write your precondition rules here: write also brief comments.
% Read the assignment, Part 2 for detailed explanations.

/*********** Successor state axioms **************/
% Write your rules here: write also brief comments.
% Read the assignment, Part 2 for detailed explanations.

:- [initRovers].
/* This is to compile also the file initRovers.pl before you
run a query. Do NOT insert this file here because your program
will be tested using different initial and goal states. */

/*————————————————————–*/
% If you would like to work on a bonus question, write below your rules that
% implement the predicate useles(Action,History). Read the Bonus part for details.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com