n - puzzle solvability check with inversion

by forhadmethun   Last Updated October 18, 2019 20:13 PM - source

I have the following matrix [[1,2,6,3],[0,9,5,7],[4,13,10,11],[8,12,14,15]] I am getting inversion 15. So logically it shouldn't be solvable. But it is solvable and I am getting the following output. Can anybody explain where I am making mistake? ref:

Why is this 8 puzzle unsolvable?

1 2 6 3 0 9 5 7 4 13 10 11 8 12 14 15

1 2 6 3 4 9 5 7 0 13 10 11 8 12 14 15

1 2 6 3 4 9 5 7 8 13 10 11 0 12 14 15

1 2 6 3 4 9 5 7 8 13 10 11 12 0 14 15

1 2 6 3 4 9 5 7 8 0 10 11 12 13 14 15

1 2 6 3 4 0 5 7 8 9 10 11 12 13 14 15

1 2 6 3 4 5 0 7 8 9 10 11 12 13 14 15

1 2 0 3 4 5 6 7 8 9 10 11 12 13 14 15

1 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15



Related Questions



How to detect matches in match-3 game?

Updated August 01, 2017 00:13 AM


Creating a Simple Puzzle resolution Algorythm

Updated March 30, 2017 10:13 AM