Fifteen puzzle solvability, Numworks Python
|
04-09-2020, 04:57 PM
Post: #11
|
|||
|
|||
RE: Fifteen puzzle solvability, Numworks Python
(04-09-2020 03:19 PM)Albert Chan Wrote: It may be best if the code return (Xrows, inversions), rather than Xrows + inversions Thanks Albert. I would rather return a single value, and if this value is even the puzzle is solvable; if it is odd, the puzzle is not solvable. By adding the row# of the 0 cell to the count of inversions, we always get a single number that tells you whether the puzzle configuration is solvable. If it is not solvable, simply switching any two items with one another makes it solvable. Most 15 puzzles don't have removeable tiles so they are always solvable, but I have one that does and I use this program whenever I play this puzzle. I have written this program for many calcs and computers: BASIC, RPN, HP65, HP12c, HP17b solver... |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)