Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- move(1,X,Y,_) :-
- write('Move top disk from '),
- write(X),
- write(' to '),
- write(Y),
- nl.
- move(N,X,Y,Z) :-
- N>1,
- M is N-1,
- move(M,X,Z,Y),
- move(1,X,Y,_),
- move(M,Z,Y,X).
- // Entrada pode ser move(4,left,center,right)
- // Lembrar que podemos resolver tal problema em (2^n - 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement