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:
<langpre>( scratchpad ) 3 1 3 2 hanoi
1->3
1->2
Line 562:
2->1
2->3
1->3</langpre>
 
=={{header|Forth}}==
Line 867:
The usage here is the same:
 
<langpre> H1 2
0 1
0 2
1 2</langpre>
 
'''Alternative solution'''<br>
Line 1,108:
hanoi(4, "1", "2", "3")</lang>
Output:
<langpre>Move disk 1 from 1 to 3
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</langpre>
=={{header|NewLISP}}==
<lang lisp>
(define (move n from to via)
(if (> n 0)
Line 1,132:
 
 
(move 4 1 2 3)</lang>
</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). */