Towers of Hanoi: Difference between revisions

no edit summary
(Added Monte example)
No edit summary
Line 674:
 
move(stdout, 4, def left {}, def right {}, def middle {})</lang>
 
=={{header|Eiffel}}==
<lang Eiffel>class
APPLICATION
 
create
make
 
feature {NONE} -- Initialization
 
make
do
move (4, "A", "B", "C")
end
 
feature -- Towers of Hanoi
 
move (n: INTEGER; frm, to, via: STRING)
require
n > 0
do
if n = 1 then
print ("Move disk from pole " + frm + " to pole " + to + "%N")
else
move (n - 1, frm, via, to)
move (1, frm, to, via)
move (n - 1, via, to, frm)
end
end
end</lang>
 
=={{header|Emacs Lisp}}==
Anonymous user