Advertisement
jsbsan

torresdehanoi

Oct 7th, 2013
2,169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 0.61 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Public Sub _new()
  4.  
  5. End
  6.  
  7. Public Sub Form_Open()
  8.  
  9. End
  10.  
  11. Public Sub ButtonSolucion_Click()
  12.  
  13.   resuelve(ValueBoxFichas.Value, 1, 3, 2)
  14.  
  15. End
  16.  
  17. Public Sub resuelve(n As Integer, inicial As Integer, final As Integer, libre As Integer)
  18.  
  19.   If n = 1 Then
  20.     TextAreaSolucion.text &= "Mover disco superior de aguja " & Str$(inicial) & ", a " & Str$(final) & gb.Cr
  21.   Else
  22.     resuelve(n - 1, inicial, libre, final)
  23.     TextAreaSolucion.text &= "Mover disco superior de aguja " & Str$(inicial) & ", a " & Str$(final) & gb.Cr
  24.     resuelve(n - 1, libre, final, inicial)
  25.   Endif
  26.  
  27. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement