exercise_hanoi.pl

loading
details
attribute value
description
owner Johannes Waldmann
uploaded 2017-08-17 03:45:08.0
disk size 456 Bytes
downloadable true
type
attribute value
name no_type
processor id 1
description this is the default benchmark type for rejected benchmarks and benchmarks that are not associated with a type.
owning community none
loading contents
%Source: http://colin.barker.pagesperso-orange.fr/sands.htm
%query:hanoi(g,g,g,g,f,f).
/* hanoi(N,A,B,C,Moves,[]) is true if Moves is the sequence of moves       */
/*   required to move N discs from peg A to peg B using peg C as an        */
/*   intermediary according to the rules of the Tower of Hanoi puzzle.     */
hanoi(1,A,B,C,[to(A,B)|Zs],Zs).
hanoi(N,A,B,C,Xs,Zs):-
  N>1, N1 is N - 1,
  hanoi(N1,A,C,B,Xs,[to(A,B)|Ys]),
  hanoi(N1,C,B,A,Ys,Zs).
popout

content may be truncated. 'popout' for larger text window.

actions get anonymous link download benchmark