Re: a challenge related to the 15 puzzle



#2

Here is a BASIC version for the HP-71b, one of my favorite calculators. It is much faster than the 32sii version, probably because it doesn't have to decode multiple numbers stored in a register.

HP 71b program to determine 15 puzzle solvability

10 destroy all
20 integer a(16)
30 data 11,5,14,7,15,2,9,4,6,0,1,13,10,3,12,8
40 for i=1 to 16
50 read a(i)
60 if a(i)=0 then let b=ip((i+3)/4)
70 next i
80 for i=1 to 15
90 for j=i+1 to 16
100 if a(j)<>0 and a(j)<a(i) then let b=b+1
110 next j
120 next i
130 if mod(b,2)=0 then disp "solvable" else disp "unsolvable"
140 disp "inversions = ";b


#3

Nice-- and easy on the eyes.. I started a 50g program that uses PUT,PUTI,GET, LOC and REPL. It's compact, but incomplete as yet.


Possibly Related Threads...
Thread Author Replies Views Last Post
  Good puzzle for kids to solve on 35s? snaggs 11 2,259 09-18-2013, 10:40 PM
Last Post: David Hayden
  Second Batch of HP-15 LE calculators Namir 6 1,633 07-02-2013, 12:27 PM
Last Post: Kimberly Thompson
  HP-15 LE Key repair question Namir 2 1,016 06-10-2013, 10:42 PM
Last Post: Namir
  Party Puzzle: for your amusement hugh steers 2 844 05-28-2013, 03:00 PM
Last Post: hugh steers
  HP 41 Mcode related Questions Michael Fehlhammer 4 1,258 05-10-2013, 07:09 PM
Last Post: Michael Fehlhammer
  The answer to the second semi-mathematical puzzle Mike Reed 3 990 02-18-2013, 02:40 AM
Last Post: Derek Walker (UK)
  Answer to Mathematical Puzzle Mike Reed 2 833 02-08-2013, 12:11 AM
Last Post: LHH
  OT: a semi mathmatical puzzle 4 u Mike Reed 6 1,428 02-05-2013, 07:50 PM
Last Post: Mike Reed
  Calculator O.T., instead HP related. Luiz C. Vieira (Brazil) 1 817 08-17-2012, 06:57 AM
Last Post: Frank Boehm (Germany)
  A new firmware beyond 2.15 for 50g ever? mr-scorpio 3 1,108 07-24-2012, 07:25 AM
Last Post: Keith Midson

Forum Jump: