Towers of Hanoi: Difference between revisions
Content added Content deleted
(→{{header|Groovy}}: new solution) |
m (fix bare lang tags) |
||
Line 555:
] when ;</lang>
In the REPL:
<
1->3
1->2
Line 562:
2->1
2->3
1->3</
=={{header|Forth}}==
Line 867:
The usage here is the same:
<
0 1
0 2
1 2</
'''Alternative solution'''<br>
Line 1,108:
hanoi(4, "1", "2", "3")</lang>
Output:
<
Move disk 2 from 1 to 2
Move disk 1 from 3 to 2
Line 1,122:
Move disk 1 from 1 to 3
Move disk 2 from 1 to 2
Move disk 1 from 3 to 2</
=={{header|NewLISP}}==
<lang lisp>
(define (move n from to via)
(if (> n 0)
Line 1,132:
(move 4 1 2 3)</lang>
=={{header|Objective-C}}==
Line 1,675 ⟶ 1,674:
and somewhat obtuse features of the REXX language, the smallest of which
is support for ASCII and EBCDIC "graphic" characters.
<lang rexx>
/*REXX program shows pictorial moves to solve Tower of Hanoi (3 disks). */
|