Towers of Hanoi: Difference between revisions

Towers of Hanoi in Gambas
(Add Miranda)
(Towers of Hanoi in Gambas)
Line 2,955:
 
In '''[https://formulae.org/?example=Tower_of_Hanoi this]''' page you can see the program(s) related to this task and their results.
 
=={{header|Gambas}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="vbnet">Public Sub Main()
Print "Three disks\n"
move_(3, 1, 2, 3)
Print
Print "Four disks\n"
move_(4, 1, 2, 3)
End
 
Public Sub move_(n As Integer, from As Integer, to As Integer, via As Integer)
 
If n > 0 Then
move_(n - 1, from, via, to)
Print "Move disk "; n; " from pole "; from; " to pole "; to
move_(n - 1, via, to, from)
End If
 
End Sub </syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
=={{header|GAP}}==
2,122

edits