Towers of Hanoi: Difference between revisions

→‎{{header|Euphoria}}: Euphoria example added
(Added Nemerle)
(→‎{{header|Euphoria}}: Euphoria example added)
Line 408:
move(1 , F, T, V),
move(N-1, V, T, F).</lang>
 
=={{header|Euphoria}}==
<lang euphoria>procedure move(integer n, sequence From, sequence To, sequence Via)
if n>0 then
move(n-1, From, Via, To)
printf(1, "Move disk %d from the %s pole to the %s pole\n", {n, From, To})
move(n-1, Via, To, From)
end if
end procedure
 
move(3, "left", "right", "middle")</lang>
 
Output:
<pre>Move disk 1 from the left pole to the right pole
Move disk 2 from the left pole to the middle pole
Move disk 1 from the right pole to the middle pole
Move disk 3 from the left pole to the right pole
Move disk 1 from the middle pole to the left pole
Move disk 2 from the middle pole to the right pole
Move disk 1 from the left pole to the right pole
</pre>
 
=={{header|FALSE}}==
Anonymous user