:- seqex(shanoi/6), det(shanoi/6), nofail(shanoi/6). 
:- mutex(hanoi/5),  det(hanoi/5),  nofail(hanoi/5). 

shanoi(0,A,B,C,R,R).
shanoi(N,A,B,C,RO,RI) :-
	N > 0,
	N1 is N - 1 ->
	shanoi(N1,C,B,A,RT,RI),
	shanoi(N1,A,C,B,RO,[mv(A,B)|RT]).

hanoi(N,A,B,C,R) :-
	N < 10,
	shanoi(N,A,B,C,R,[]).

hanoi(N,A,B,C,[R1,mv(A,B),R2]) :-
	N >= 10,
	N1 is N - 1 ->
	(hanoi(N1,A,C,B,R1) // hanoi(N1,C,B,A,R2)).


han(done) :- hanoi(15,a,b,c,List).
?- han(X). 

