Advertisement
SmartGenius

Solve Hanoi Towers in Batch

Jul 6th, 2012
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. :::::::::::::::::::::::::::::::::::::::::
  4. ::Script Para Resolver Torres de Hanoi.::
  5. ::Creado por Hugo Guerrero (Guerrerohgp):
  6. :::::::::::::::::::::::::::::::::::::::::
  7.  
  8. :ini
  9. set/p "cantidad=Ingrese el numero de discos en la torre: "
  10. if not defined cantidad goto:ini
  11. if !cantidad! lss 0 goto:ini
  12. call:algoritmoHanoi !cantidad! Torre_1 Torre_2 Torre_3
  13. pause
  14. exit
  15.  
  16. :algoritmoHanoi
  17. setlocal
  18. if "%1" equ "0" goto:eof
  19. set/a "cnt=%1-1"
  20. call:algoritmoHanoi !cnt! %2 %4 %3
  21. echo.Mover disco %1 de %2 a %4
  22. call:algoritmoHanoi !cnt! %3 %2 %4
  23. endlocal
  24. goto:eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement