Fifteen puzzle solvability, Numworks Python
|
04-08-2020, 10:41 AM
(This post was last modified: 04-28-2020 02:24 PM by Don Shepherd.)
Post: #1
|
|||
|
|||
Fifteen puzzle solvability, Numworks Python
I just received a Numworks calculator and implemented a Python program to determine if a given configuration of the fifteen puzzle is solvable. Very interesting and beautiful calculator. I contacted Numworks with a question and the president of the company replied; excellent support.
List a contains the initial configuration of the 15 puzzle pieces (that you want to test) and the empty (0) cell. The 99 at the beginning is there so I could more easily convert an existing HP-17 solver equation, since the Numworks list starts at index 0. The program returns the sum of the number of inversions and row number (1-4) of the empty cell. If this number is even, the puzzle configuration is solvable. Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)