hanoi(N) :- nl, nl, move(N,left,centre,right). move(0,_,_,_) :- !. move(N,A,B,C) :- M is N - 1, move(M,A,C,B), inform(A,B), move(M,C,B,A). inform(X,Y) :- write('move disc from '),write(X),write(' pole to the '), write(Y),write(' pole.'),nl.