Post Reply 
Weakest calculator/pocket computer that can do Tower of Hanoi?
08-15-2018, 08:12 PM
Post: #30
RE: Weakest calculator/pocket computer that can do Tower of Hanoi?
Now that we know that binary operations and remainder are useful in an iterative solution here's a version for the HP-16C:
Code:
01 RCL I
02 ENTER
03 ENTER
04 CHS
05 AND
06 -
07 RCL I
08 LSTx
09 +
10 3
11 RMD
12 x<>y
13 3
14 RMD
15 ISZ

Initialisiation

DEC
1
STO I
RTN


Endless Loop

R/S
Y: to
X: from


Example:

R/S
0
R↓
2

R/S
0
R↓
1

R/S
2
R↓
1

R/S
0
R↓
2



Thus:
  1. move disk from peg 0 to peg 2
  2. move disk from peg 0 to peg 1
  3. move disk from peg 2 to peg 1
  4. move disk from peg 0 to peg 2



It doesn't tell you which disk to move but that's not needed.

Kind regards
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-15-2018 08:12 PM



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