Weakest calculator/pocket computer that can do Tower of Hanoi? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not quite HP Calculators - but related (/forum-8.html) +--- Thread: Weakest calculator/pocket computer that can do Tower of Hanoi? (/thread-11209.html) Pages: 1 2 |
RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-13-2018 01:07 PM 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 Prog 1 - This is a register-packing "get" routine. Code: P[Int(I÷9→Z Prog 2 - And this is the corresponding "put" routine. Code: D→H 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 RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-13-2018 01:31 PM (08-13-2018 11:47 AM)Thomas Klemm Wrote: I've used from Binary solution of Tower of Hanoi:from Martin Gardner's [attachment=6205] chapter 6, page 67 … Quote:The isomorphism of the Tower ofHanoi’s solution and the Hamil-bold & italic my emphasis BEST! SlideRule yet another reference [attachment=6206] RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018 03:58 PM (08-12-2018 06:07 PM)Thomas Okken Wrote: As far as I'm aware, that behavior is a bug in the HP-25 (and 25C), not found in other HP models. See http://www.hpmuseum.org/forum/thread-9566.html Thanks for the link. That was an interesting read. I was happily watching the blinkenlichten while the HP-25 emulator was calculating. So I tried to maximise the duration by using \(2^{33}=8,589,934,592\) but was slightly disappointed by the result: Only disk 5? Whereas I've expected 34. Turned out the given result was \(8,589,934,605\) which is off by \(13\). So I've entered the correct value manually. Those of you who wonder how an odd number could lead to disk 5 may notice that all the values are rounded to 10 digits. So that's a limitation of the program: \(0<n\leqslant10^{9}\). RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-13-2018 04:02 PM (08-13-2018 01:31 PM)SlideRule Wrote: yet another reference Thank you for all of your references. I've always loved the books by Martin Gardner. Kind regards Thomas RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-14-2018 12:47 AM (08-13-2018 11:47 AM)Thomas Klemm Wrote: There are 12 lines left that could be used for a loop or a fancy display or what not. Meanwhile I was able to remove another step. This allows to output a single line in an infinite loop: Code: 01 1 ; 1 Make sure to have the display set to FIX 2 which is the default after starting up the calculator. Example: GTO 00 R/S X: 1.02 R/S X: 2.01 R/S X: 1.21 R/S X: 3.02 R/S X: 1.10 … Thus:
Cheers Thomas RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Paul Dale - 08-14-2018 04:18 AM Nice! I can stop looking now Pauli RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Jake Schwartz - 08-15-2018 03:49 PM For what it is worth, the earliest Tower of Hanoi program I could find in the PPC Journal is Harry Bertuccelli's HP-41C 164-step version, which appeared in Volume 8 Number 3 Page 22 (from May 1981). It also utilized four PPC ROM routines (HD, UD, LR, SR). Jake RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-15-2018 04:39 PM (08-15-2018 03:49 PM)Jake Schwartz Wrote: For what it is worth, the earliest Tower of Hanoi program I could find in the PPC Journal is Harry Bertuccelli's HP-41C 164-step version, which appeared in Volume 8 Number 3 Page 22 (from May 1981). It also utilized four PPC ROM routines (HD, UD, LR, SR). Interesting, I would have expected there would be something for the 65 or 67, since the problem can clearly be handled with a 25. I should rummage through scans of PPC Notes to see if it was done on the TI-59 (or its kin). EDIT: Here's a massive 559-step TI-59 version, though it seems to have more features than just a solver (you can play interactively, and print the state of the game to an attached printer). Search for program 918122 on this page. http://www.rskey.org/CMS/index.php/the-library/15 RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Gene - 08-15-2018 05:31 PM Couple of other TI-59 Hanoi programs. Recursive - 88 steps: 88 steps Another one - 275 steps but prints each move showing towers!: Hanoi with print out and the 560 step TI-59 version: 560 steps RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Thomas Klemm - 08-15-2018 08:12 PM 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 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:
It doesn't tell you which disk to move but that's not needed. Kind regards Thomas RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-29-2018 11:32 PM OK, it took a while BUT I finally retrieved the source listing for the PC-2 (1500) HHC. Code: 7 "HANOI TOWERS I think my initial response was on the PRIME sub-Forum but it seemed appropriate to post the BASIC listing here. BEST! SlideRule RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - Dave Britten - 08-30-2018 03:36 PM (08-29-2018 11:32 PM)SlideRule Wrote: OK, it took a while BUT I finally retrieved the source listing for the PC-2 (1500) HHC. Cool! Thanks for posting the listing. I'll have to dig out my PC-2 and give it a try. I tend to prefer the Casios over the Sharps, largely because of the separate program spaces making them more convenient standalone systems, but there's no denying that the PC-2/PC-1500 was the most powerful of its contemporaries. I should really hunt down a cassette interface for it some day. RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 08-30-2018 11:57 PM NOT the original Tower of Hanoi program for the ZX81 but … [attachment=6266] … enjoy. BEST! SlideRule RE: Weakest calculator/pocket computer that can do Tower of Hanoi? - SlideRule - 10-29-2018 02:15 PM Even longer still … Turing's sword See you our server farm that hums And serves HTTP? It's spun its disk and done its sums Ever since Berners-Lee. See you our mainframe spewing out The Towers of Hanoi? It's moved recursive disks about Since Babbage was a boy. See you our ZX81 That prints the ABCs? That very program used to run With Lovelace at the keys. Magnetic floppy disks and hard, And tape with patience torn, And eighty columns on a card, And so was England born! She is not any common thing, Water or Wood or Air, But Turing's Isle of Programming, Where you and I will fare. from Time Blew Away Like Dandelion Seed, Thomas Thurman … but finally found it. BEST! SlideRule |