Towers of Hanoi: Difference between revisions
Content added Content deleted
(Added a Clojure implementation.) |
(→{{header|Haskell}}: ++ gnu octave) |
||
Line 339: | Line 339: | ||
END PROGRAM TOWER</lang> |
END PROGRAM TOWER</lang> |
||
=={{header|GNU Octave}}== |
|||
<lang octave>function hanoimove(ndisks, from, to, via) |
|||
if ( ndisks == 1 ) |
|||
printf("Move disk from pole %d to pole %d\n", from, to); |
|||
else |
|||
hanoimove(ndisks-1, from, via, to); |
|||
hanoimove(1, from, to, via); |
|||
hanoimove(ndisks-1, via, to, from); |
|||
endif |
|||
endfunction |
|||
hanoimove(4, 1, 2, 3);</lang> |
|||
=={{header|Haskell}}== |
=={{header|Haskell}}== |