Post Reply 
(HP-67/97) a little fun with the fifteen puzzle
05-02-2017, 03:03 PM
Post: #14
RE: (HP-67/97) a little fun with the fifteen puzzle
Here's a quick 16C version of Don's 65 program. The bit manipulation/counting instructions make this algorithm pretty trivial on this model: you don't have to implement any kind of loop for bit counting, just mask them off and use #B to get a count. Of course, the lack of register arithmetic adds a few unnecessary steps. But 25 steps and 2 registers ain't bad!

For this version, enter the row with the blank, GSB A, then enter each tile number followed by R/S. Make sure your word size is set to at least 16.

Code:
43,22,A         LBL A
42 34           CLEAR REG
44 2            STO 2
31              R/S
43,22,B         LBL B
1               1
34              X><Y
42 E            RLn
43 36           LSTx
34              X><Y
45 1            RCL 1
42 40           OR
44 1            STO 1
34              X><Y
1               1
40              +
42 8            MASKR
42 30           NOT
42 20           AND
43 7            #B
45 2            RCL 2
40              +
44 2            STO 2
31              R/S
22 B            GTO B
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (HP-67/97) a little fun with the fifteen puzzle - Dave Britten - 05-02-2017 03:03 PM



User(s) browsing this thread: 2 Guest(s)