Post Reply 
Weakest calculator/pocket computer that can do Tower of Hanoi?
08-12-2018, 01:19 PM (This post was last modified: 08-12-2018 01:34 PM by Thomas Okken.)
Post: #12
RE: Weakest calculator/pocket computer that can do Tower of Hanoi?
(08-12-2018 09:35 AM)Thomas Klemm Wrote:  
(08-12-2018 07:46 AM)Thomas Okken Wrote:  That program always returns 1, for any input.

That's weird. Are you sure that you've entered these lines?
Code:
13 1
14 +

I am. Are you sure you have even tested this program? Those two lines are never reached. Here's what happens:

Code:
01▸LBL A   X:n
02 1       X:1 Y:n
03▸LBL 0
04 x<>y    X:n Y:1
05 2       X:2 Y:n Z:1
06 ÷       X:n/2 Y:1
07 FRAC    X:0 or 0.5 Y:1
08 x≠y     always true, see above!
09 GTO 1
16▸LBL 1
17 R↓      X:1 T:0 or 0.5
18 RTN

UPDATE: Ah, we posted at the same time -- never mind.

However,

(08-12-2018 09:35 AM)Thomas Klemm Wrote:  If you desperately need to know the positions they could be calculated from n and a(n)

I wouldn't call myself particularly desperate, but merely specifying which disc is moved at each step, without saying from where to where, looks like only half a solution to me. If you had read my second program more carefully, you would have noticed that it performs the same calculation that yours does, and then it works out the exact move. All your program accomplishes is to amputate two thirds of the logic. What's left certainly fits in an HP-25, but I wouldn't call that sequence a solution to the Towers of Hanoi puzzle, but merely an interesting property of such a solution.
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:19 PM



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