Task

Solve the   Towers of Hanoi   problem with recursion.




' FB 1.05.0 Win64
 
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
 
Print "Three disks" : Print
move 3, 1, 2, 3 
Print 
Print "Four disks" : Print
move 4, 1, 2, 3
Print "Press any key to quit"
Sleep