in reply to Towers of Hanoi
perl hanoi.pl 4
If no variable was passed I would like for it to default to just 3. I am looking to just impress my friends. I am taking psy200. I am not sure how to begin to look at solving this. If the above was typed in at the command line I would like to see the following result.
A-B
A-C
B-C
A-B
C-A
C-B
A-B
A-C
B-C
B-A
C-A
B-C
A-B
A-C
B-C
DONE!!!!! Finished in 15 moves!!!!
This is more so illustrated at this site and also solved for 3-7. I am looking to solve for any number (or as many as possible). Any help in this would be awesome, as I am sure this will be a fun project.
Thanks,
LeGo
UPDATE: I found the solution above did work for me. It just needed the arguement passed in on command line. The answer was posted in more detail here. It would still be nice to be able to see how many moves it took...
|
---|