Commit c3d875bc authored by Sergey Pomazanov's avatar Sergey Pomazanov
Browse files

fix fifteen puzzle odd shuffle

An incorrect case may be generated for an odd board size.
parent 08379776
Pipeline #182383 passed with stage
in 1 minute and 28 seconds
......@@ -87,7 +87,7 @@ Item {
var sizeMod2 = Math.floor(boardSize % 2);
var inversionsMod2 = Math.floor(inversions % 2);
var solveable = (sizeMod2 == 1 && inversionsMod2 == 0) ||
(sizeMod2 == 0 && inversionsMod2 == 0) == (Math.floor((boardSize - blankRow) % 2) == 1);
(sizeMod2 == 0 && (inversionsMod2 == 0) == (Math.floor((boardSize - blankRow) % 2) == 1));
if (!solveable) {
// make the grid solveable by swapping two adjacent pieces around
var pieceA = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment