Post Reply 
Weakest calculator/pocket computer that can do Tower of Hanoi?
08-12-2018, 01:46 AM (This post was last modified: 08-12-2018 02:14 AM by Thomas Okken.)
Post: #5
RE: Weakest calculator/pocket computer that can do Tower of Hanoi?
A bit smarter algorithm, taking advantage of the fact that if you're not displaying the towers anyway, and only showing the sequence of moves, you don't have to keep track of where the discs are:

Code:
01▸LBL 0
02 STO 0
03 CLX
04 STO 1
05▸LBL 1
06 1
07 STO+ 1
08 RCL 0
09 STO 2
10 RCL 1
11▸LBL 2
12 2
13 ÷
14 ENTER
15 INT
16 X≠Y?
17 GTO 3
18 1
19 STO- 2
20 R↓
21 GTO 2
22▸LBL 3
23 RCL 2
24 X=0?
25 RTN
26 2
27 ÷
28 FRAC
29 2
30 ×
31 1
32 +
33 ×
34 ENTER
35 ENTER
36 LASTX
37 +
38 ENTER
39 ENTER
40 3
41 ÷
42 INT
43 3
44 ×
45 -
46 X<>Y
47 ENTER
48 ENTER
49 3
50 ÷
51 INT
52 3
53 ×
54 -
55 1
56 0
57 ×
58 +
59 1
60 1
61 +
62 R/S
63 GTO 1

Better, but still too long for the HP-25. Not having MOD really hurts. Smile
Visit this user's website 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 Okken - 08-12-2018 01:46 AM



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