HP Forums

Full Version: Re: a challenge related to the 15 puzzle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Don,
That's an interesting article. It reminds me very much of a Turing state machine, whereby the numbers in each grid become a GOTO instruction. It basically counts the number of closed GOTO loops in the grid- really interesting approach!

With one register in each variable, this would be interesting to do using indirect registers. Pseudo code for 41cv/42s:

0. Enter matrix in registers 1-15
1. Format Stack, clear parity flag
2. recall register 1
3. use -1 STO* IND ST Y to mark the register "visited"
4. indirectly recall next memory location
5. If greater than 0 goto 3,
6. starting from beginning of matrix find first number > 0
if == 00 (register 16) goto 9
7. Toggle parity flag
8. goto 3
9. recall parity flag (done)