Affichage corrigé
This commit is contained in:
parent
b3ed6a00de
commit
0937e66efb
1 changed files with 17 additions and 21 deletions
38
TP1.pl
38
TP1.pl
|
@ -693,7 +693,7 @@ main :-
|
||||||
insert([[H,H,0],S0],Pf0,Pf), % CORRECT
|
insert([[H,H,0],S0],Pf0,Pf), % CORRECT
|
||||||
insert([S0,[H,H,0],nil,nil],Pu0,Pu), % CORRECT
|
insert([S0,[H,H,0],nil,nil],Pu0,Pu), % CORRECT
|
||||||
% lancement de Aetoile
|
% lancement de Aetoile
|
||||||
aetoile(Pf,Pu,Q).
|
aetoile(Pf,Pu,Q), !.
|
||||||
|
|
||||||
%*******************************************************************************
|
%*******************************************************************************
|
||||||
aetoile(Pf, Pu, _) :-
|
aetoile(Pf, Pu, _) :-
|
||||||
|
@ -707,10 +707,6 @@ aetoile(Pf, _, Qs) :-
|
||||||
suppress([Fin,[F,H,G],Pere,Action],_Pu,_Pu_new),
|
suppress([Fin,[F,H,G],Pere,Action],_Pu,_Pu_new),
|
||||||
write("Solution trouvée !"),
|
write("Solution trouvée !"),
|
||||||
writeln(""),
|
writeln(""),
|
||||||
write("Pere = "),print(Pere),
|
|
||||||
writeln(""),
|
|
||||||
write("Action = "),print(Action),
|
|
||||||
writeln(""),
|
|
||||||
affiche_solution([Fin,[F,H,G],Pere,Action], Qs).
|
affiche_solution([Fin,[F,H,G],Pere,Action], Qs).
|
||||||
|
|
||||||
aetoile(Pf, Pu, Qs) :-
|
aetoile(Pf, Pu, Qs) :-
|
||||||
|
@ -740,28 +736,28 @@ expand(U,G,L):- findall(U3,(rule(Action,1,U,U2),heuristique(U2,H), F is H+G+1, G
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
affiche_solution([_,_,nil,nil],_) :- write(1).
|
affiche_solution([Debut,_,nil,nil],_) :-
|
||||||
|
initial_state(Debut),
|
||||||
|
write("Etat initial : ").
|
||||||
|
|
||||||
|
affiche_solution(State,Qs) :-
|
||||||
|
State = [U,[_,_,G],Pere,Action],
|
||||||
|
final_state(U),
|
||||||
|
suppress([Pere,Cout,Pere1,Action1],Qs, Qs_new),
|
||||||
|
affiche_solution([Pere,Cout,Pere1,Action1],Qs_new),
|
||||||
|
writeln(""),
|
||||||
|
write("Final state : "),
|
||||||
|
print(U).
|
||||||
|
|
||||||
affiche_solution(State,Qs):-
|
affiche_solution(State,Qs):-
|
||||||
State = [U,[_,_,G],Pere,Action],
|
State = [U,[_,_,G],Pere,Action],
|
||||||
print(U),
|
suppress([Pere,Cout,Pere1,Action1],Qs, Qs_new),
|
||||||
|
affiche_solution([Pere,Cout,Pere1,Action1],Qs_new),
|
||||||
|
print(U),
|
||||||
writeln(""),
|
writeln(""),
|
||||||
write("Cout = "), print(G),
|
write("Cout = "), print(G),
|
||||||
writeln(""),
|
writeln(""),
|
||||||
write("Action = "), print(Action),
|
write("Action = "), print(Action).
|
||||||
writeln(""),
|
|
||||||
write(1),
|
|
||||||
writeln(""),
|
|
||||||
suppress([Pere,Cout,Pere1,Action1],Qs, Qs_new),
|
|
||||||
write(2),
|
|
||||||
writeln(""),
|
|
||||||
write("Pere = "),print(Pere),
|
|
||||||
writeln(""),
|
|
||||||
write("Pere1 = "),print(Pere1),
|
|
||||||
writeln(""),
|
|
||||||
write("Action1 = "),print(Action1),
|
|
||||||
writeln(""),
|
|
||||||
affiche_solution([Pere,Cout,Pere1,Action1],Qs_new).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue