Script puzzle: Solving Hanoi ... in shell
If you like CMD programming, here is a challenge for you: write a CMD batch file that solves the Hanoi problem. You start with these folders:
and you must end up with this state:
You probably know the rules of the Hanoi problem. Mapped in the command shell terminology these rules are as follows:
1) You can move one file at a time, and only between the Stack1, Stack2 and Stack3 directories.
2) After you move a file into a target directory, it should always appear first in the DIR command (that is, lexicographically, must be the first one).
Good luck!
Comments
- Anonymous
January 27, 2005
other 110 (!!!) implementations of the Hanoi problem, here at Hanoimania:
http://www.kernelthread.com/hanoi/ - Anonymous
February 23, 2005
With a few "value-adds" ;)
http://dcortesi.com/archives/2005/02/23/hanoi_in_batch.html - Anonymous
February 23, 2005
Excellent solution!