Weakest calculator/pocket computer that can do Tower of Hanoi?
08-13-2018, 01:07 PM
Post: #21
 Dave Britten Senior Member Posts: 2,307 Joined: Dec 2013
RE: Weakest calculator/pocket computer that can do Tower of Hanoi?
Very nice code, Thomas. I'll have to see if I can use any of that algorithm to improve my clumsy Casio fx-7000g version.

(N.B.: I've used the more standard ^ symbol for the x^y key, and (10^) to represent the small "10" that corresponds to 10^x.)

Prog 0
Code:
Mcl Range 1,95,0,1,64,0 "N"?→N 2Frac (N÷2→O 2^N-1→M 9→P:9→Q:9→R N→U:9→V:18→W U→I Lbl 0 N-I+1→D Prog 2 Dsz I:Goto 0 1→B Prog 3 Lbl 1 B→F B+1+O→G G>3⇒G-3→G B+2-O→B B>3⇒B-3→B T[F→I:Prog 1 D→C T[G→I:Prog 1 C<D⇒Goto 2 D→C:F→S:G→F:S→G Lbl 2 0→D:T[F→I:Prog 2 Dsz T[F]:Ans Isz T[G] C→D:T[G→I:Prog 2 Prog 3 Dsz M Goto 1

Prog 1 - This is a register-packing "get" routine.
Code:
P[Int(I÷9→Z 9Frac (I÷9→E 10Frac (Int (Z÷(10^)E)÷10→D

Prog 2 - And this is the corresponding "put" routine.
Code:
D→H Prog 1 Z-D(10^)E+H(10^)E→P[Int (I÷9)]

Prog 3 - Display routine. There's no way to selectively erase parts of the screen, so the entire screen must be cleared and redrawn after each move.
Code:
Cls -14→J 0→I Lbl 1 J+16→J 0→K Lbl 2 Prog 1 D=0⇒Goto 3 K+2→K Plot J+8-D,K Plot J+7+D,K Line Lbl 3 Isz I 0≠Frac (I÷9⇒Goto 2 I<27⇒Goto 1
 « 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)