(HP-67/97) a little fun with the fifteen puzzle
05-03-2017, 12:03 AM
Post: #15
 Don Shepherd Senior Member Posts: 749 Joined: Dec 2013
RE: (HP-67/97) a little fun with the fifteen puzzle
(05-02-2017 03:03 PM)Dave Britten Wrote:  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

Thanks Dave, the 16c is a great calculator. In fact it was the first HP I ever owned, back in the early 80's.

Yes, I was thinking as I was looking at the 65 code that a loop would be unnecessary if we could only sum the bit range rather than looping through all the bits looking for a 1, but I didn't see an easy way to do that.
 « Next Oldest | Next Newest »

 Messages In This Thread (HP-67/97) a little fun with the fifteen puzzle - Don Shepherd - 12-03-2016, 09:26 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Dieter - 12-05-2016, 09:51 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Gene - 12-05-2016, 10:07 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Dieter - 12-06-2016, 07:06 AM RE: (HP-67/97) a little fun with the fifteen puzzle - PedroLeiva - 04-26-2017, 10:59 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Don Shepherd - 12-06-2016, 12:24 AM RE: (HP-67/97) a little fun with the fifteen puzzle - SlideRule - 12-06-2016, 01:43 AM RE: (HP-67/97) a little fun with the fifteen puzzle - Don Shepherd - 12-06-2016, 03:46 AM RE: (HP-67/97) a little fun with the fifteen puzzle - SlideRule - 12-06-2016, 12:52 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Don Shepherd - 12-06-2016, 05:14 AM it turns out there is a solution for the HP-65 after all - Don Shepherd - 04-26-2017, 08:37 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Gene - 04-27-2017, 02:01 AM RE: (HP-67/97) a little fun with the fifteen puzzle - PedroLeiva - 04-27-2017, 12:04 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Dave Britten - 05-02-2017, 03:03 PM RE: (HP-67/97) a little fun with the fifteen puzzle - Don Shepherd - 05-03-2017 12:03 AM

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