Tutorial Towers of Hanoi Solver Knowledge Base /* File: hanoi.pl Author: James Ashworth This gives the sequence of moves to transfer N discs from peg X to peg Z via peg Y */ move(1,X,_,Z) :- write('Move disc 1 from peg '), write(X), write(' to peg '), write(Z), write_ln('.'). move(N,X,Y,Z) :- N1 is N - 1, move(N1,X,Z,Y), write('Move disc '), write(N), write(' from peg '), write(X), write(' to peg '), write(Z), write_ln('.'), move(N1,Y,X,Z). Queries move(3, 1, 2, 3). Run Output