0

I'm having trouble with my n-puzzle solver. Thought it was working, but it turns out it is solving insoluble puzzles. I've tried to trace it, but that's a lot of tracing and so far I see no cheating. I think I understand the algorithm for determining solubility, and my implementation agrees with the odd/even parity of some examples from the web... that is to say, when I count up the number of tiles after a given tile that are smaller than it, for every tile, and then add the row index of the blank tile, I get the same odd or even number as others have gotten.

So a thought that has occurred to me. In my model of, say, the 8-puzzle, my solution state is:

_ 1 2
3 4 5
6 7 8

Rather than

1 2 3
8 _ 4
7 6 5

Or

1 2 3
4 5 6
7 8 _

As it is in some other formulations. Could this be affecting which puzzles are soluble and which are not?

Thanks!

z.

Ziggy
  • 21,845
  • 28
  • 75
  • 104
  • Look up "8 puzzle parity" or "15 puzzle parity". The rules for calculating the parity are the same (but the puzzles have different parity in the standard bottom-right solved position). –  Jan 11 '13 at 05:22

1 Answers1

1

In general, yes: If a configuration is solvable to the standard solution, it will not be solvable to an unsolvable configuration.

In particular, it depends on the exact configuration you're using as a solution. You will need to check to see if you can solve from that configuration to the standard one.

EDIT: This of it this way:

Let A be the standard solution. Let B be your preferred solution. Let C be your starting configuration.

If you can get from A to B, and you can get from C to A, then you can get from C to B. But if you can't get from A to B, and you can get from C to A, then you can't get from C to B.

Novak
  • 4,687
  • 2
  • 26
  • 64
  • What exactly does that first line mean. "If a configuration is solvable to the standard solution" I understand, but "it will not be solvable to an unsolvable configuration" is not clear to me. If I take one of the goal positions shown above and "solve it" into the standard goal position show on, say, wolfram, then my puzzle is... solvable? unsolvable? – Ziggy Oct 07 '12 at 16:27
  • Ah ah. This makes sense: if I can "solve" my goal configuration... then my goal configuration is... congruent? to the normal goal configuration... and normal counting of parity will work? – Ziggy Oct 07 '12 at 16:31