HP Forums
Re: a challenge related to the 15 puzzle - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Re: a challenge related to the 15 puzzle (/thread-177169.html)



Re: a challenge related to the 15 puzzle - Allen - 01-17-2011

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)