(16C) Tower of Hanoi - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (16C) Tower of Hanoi (/thread-21171.html) (16C) Tower of Hanoi - Thomas Klemm - 01-17-2024 08:38 AM I used from Binary solution of Tower of Hanoi: Quote:Another formulation is from peg (m - (m & -m)) % 3 to peg (m + (m & -m)) % 3 This is an iterative solution for the HP-16C: Code: ```   000 {          }     001 {    45 32 } RCL I    002 {       36 } ENTER    003 {       36 } ENTER    004 {       49 } CHS    005 {    42 20 } f AND    006 {       30 } -    007 {    45 32 } RCL I    008 {    43 36 } g LSTx    009 {       40 } +    010 {        3 } 3    011 {    42  9 } f RMD    012 {       34 } X<=>Y    013 {        3 } 3    014 {    42  9 } f RMD    015 {    43 24 } g ISZ``` Initialisation 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: move disk from peg 0 to peg 2 move disk from peg 0 to peg 1 move disk from peg 2 to peg 1 move disk from peg 0 to peg 2 … It doesn't tell you which disk to move but that's not needed. This solution came up in this older thread: Weakest calculator/pocket computer that can do Tower of Hanoi? It is an excerpt from post #20 and post #30. I stumbled upon this thread recently: New HP 16C Simulator released: JRPN 16C On the linked page JRPN - Jovial Reverse Polish Notation Calculators Valentin's solution is mentioned: Launch the 16C with Towers of Hanoi programmed under GSB A. You can start the simulator with my program here: HP-16C The state is already initialised so you can start with R/S …