home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / game / board / tower.sit / Hanoi.HT < prev    next >
Encoding:
Text File  |  1989-09-26  |  4.0 KB  |  88 lines

  1. %% Times 12
  2. % Introduction
  3.  
  4. The \bTowers of Hanoi\e is a Macintosh version of a classic mathematical
  5. puzzle.  The usual version of this puzzle consists of a wooden base with
  6. three posts.  At the start of the game, a number of disks in graduated
  7. sizes are stacked on one of the posts so that the smallest disk is on top.
  8. The object of the puzzle is to move the entire stack of disks to another
  9. post, subject to the following restrictions:
  10.     1. You may only move one disk at a time -- all the other disks
  11.     must remain on a post.
  12.     2. You may only move the topmost disk on any post.
  13.     3. At no time can a larger disk rest upon a smaller disk.
  14.  
  15. A little experimentation with this puzzle will convince you that the
  16. minimum number of moves required to solve it grows rapidly as the
  17. initial number of disks is increased.  In fact, if there are 'N' disks,
  18. then it will take 2 raised to the Nth power, minus one moves to complete
  19. the puzzle.  So three disks takes 7 moves, 4 disks takes 15 moves, 
  20. 5 disks takes 31 moves, and so on.
  21.  
  22. According to George Gamow in his book \iOne, Two, Three, Infinity\e,
  23. the prototype for this puzzle originated in a temple in Hanoi, where
  24. monks patiently work on a puzzle containing 64 golden disks.  Legend
  25. says that when that puzzle is finally solved, the temple, the earth,
  26. and the entire universe will vanish in a clap of thunder.  Nervous
  27. readers should work out how many moves will be required to solve a
  28. 64-disk puzzle before they begin to panic.
  29.  
  30. % The Towers Application
  31.  
  32. With this program, you can experiment with puzzles containing from
  33. two to ten disks.  When the program starts, the disks are stacked up on
  34. the left-hand pin.  To move a disk, click anywhere on or near the stack.
  35. The topmost disk in the stack will be highlighted.  Then click anywhere
  36. near the pin to which you want to move the disk.  The selected disk will
  37. be moved.  Continue moving disks in the same way until you  solve the
  38. puzzle.  As you move, the program will display the number of moves
  39. you have done, together with the theoretical minimum number of moves.
  40.  
  41. If you wish to take back your last move, select "Undo" from the Edit
  42. menu.  Only the most recent move can be taken back. 
  43.  
  44. % Menus
  45.  
  46. The \bFile\e menu contains only the \bQuit\e command.
  47.  
  48. The \bEdit\e menu contains the usual \bUndo, Cut, Copy,\e and \bPaste\e
  49. commands.  Only the \bUndo\e command is used by the Towers program.
  50.  
  51. The \bCommands\e menu contains these commands:
  52.     \bNew\e -- Start the Puzzle at the beginning.
  53.     \bRun\e -- Let the computer solve the puzzle.  This command may
  54.     only be used with the disks in the starting position.
  55.     \bStep\e -- Like \bRun\e, except that a single move is made each
  56.     time the \bStep\e command is given.
  57.     \bHelp\e -- You're doing it.
  58.  
  59. The \bOptions\e menu contains these commands:
  60.     \b2 Disks\e through \b10 Disks\e -- use this many disks.  (Issuing
  61.     one of these commands also restarts the puzzle.)
  62.     \bSlow, Faster, Fastest\e -- The \bFaster\e setting speeds up the
  63.     animation somewhat, and the \bFastest\e setting
  64.     suppresses the animation altogether.  Use the \bFastest\e
  65.     setting when using the computer to solve a puzzle with a large 
  66.     number of disks, unless you enjoy staring at mindless screen 
  67.     activity for long periods of time. (sort of like network television)
  68.     \bSound\e -- Toggle the sound on and off.
  69.     \bCycle Colors\e -- Allows you some choice over what colors
  70.     are used for the disks.  Of course, if you don't have a color 
  71.     monitor, this command won't be very satisfying.
  72.  
  73. % Miscellaneous
  74.  
  75. \bTowers\e is FreeWare.  You may copy this application and give it away.
  76. You may NOT sell it or incorporate it into any commercial software
  77. distribution without the written permission of the author.
  78.  
  79. \bTowers\e was written in Think C.  Portions of the runtime code
  80. are Copyrighted ⌐ 1989 by Semantic Corporation.  This help message
  81. was written and displayed using Robert Momsen's Help Compiler.
  82.  
  83. \bTowers\e was written by William M. Leue, and is Copyrighted ⌐ 1989
  84. by William M. Leue.  For further information, contact the author at:
  85.             William M. Leue
  86.             Wildman Software
  87.             87 Brookline Ave.
  88.             Albany, NY 12203