Weakest calculator/pocket computer that can do Tower of Hanoi?
08-13-2018, 01:38 AM
Post: #17
 Paul Dale Senior Member Posts: 1,837 Joined: Dec 2013
RE: Weakest calculator/pocket computer that can do Tower of Hanoi?
(08-12-2018 05:08 PM)Thomas Klemm Wrote:  PS: I wasn't aware that the ENTER in the first line is needed.

Specify that the program is run after ENTER has been pressed. To expand this to a complete solution the oddness of the input is required, so a STO as the first step avoids the issue.
I wonder if the sign of the output could indicate the direction of the move rather than calculating the final position?

Anyway, here is a 49 step programme for the HP 25 that gives the solution to an n level Tower of Hanoi problem:

Code:
01  STO 4 02  1 03  2 04  STO 0 05  1 06  3 07  STO 1 08  2 09  3 10  STO 2 11  RCL 4 12  2 13  / 14  FRAC 15  x=0? 16  GTO 22 17  RCL 0 18  RCL 1 19  STO 0 20  Rv 21  STO 1 22  2 23  RCL 4 24  y^x 25  . 26  9 27  - 28  INT 29  RCL 0 30  PSE 31  Rv 32  1 33  - 34  x=0? 35  GTO 00 36  RCL 1 37  PSE 38  Rv 39  1 40  - 41  x=0? 42  GTO 00 43  RCL 2 44  PSE 45  Rv 46  1 47  - 48  x!=0? 49  GTO 29

To run:
1. GTO 00
2. Enter n
3. R/S

The program will display a sequence of two digits numbers that represent the poles moved between, pick the legal move in each case.

For a three high tower these are:

Code:
Display   Meaning 13        move the disc from pole 1 to 3 12        move the disc from pole 1 to 2 23        move the disc from pole 3 to 2 13        move the disc from pole 1 to 3 12        move the disc from pole 2 to 1 23        move the disc from pole 2 to 3 13        move the disc from pole 1 to 3

Pauli
 « Next Oldest | Next Newest »

 Messages In This Thread Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-11-2018, 05:26 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-11-2018, 06:42 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-11-2018, 06:52 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-11-2018, 08:35 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 01:46 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-12-2018, 01:52 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 07:16 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 07:46 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 08:10 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 09:35 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 01:19 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 01:16 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 01:32 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-12-2018, 05:08 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-12-2018, 06:07 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-13-2018 01:38 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Okken - 08-13-2018, 03:40 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-13-2018, 07:03 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-13-2018, 12:45 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018, 11:47 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-13-2018, 01:31 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-13-2018, 01:07 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018, 03:58 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018, 04:02 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-14-2018, 12:47 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-14-2018, 04:18 AM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Jake Schwartz - 08-15-2018, 03:49 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-15-2018, 04:39 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Gene - 08-15-2018, 05:31 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-15-2018, 08:12 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-29-2018, 11:32 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-30-2018, 03:36 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-30-2018, 11:57 PM RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 10-29-2018, 02:15 PM

User(s) browsing this thread: 1 Guest(s)