Skip to content

Commit

Permalink
initialize before new length check
Browse files Browse the repository at this point in the history
fixes #9
related to #1 as we were seeing a thrown-away grid compared to saved
  • Loading branch information
gordonwoodhull committed Oct 7, 2023
1 parent 9998c8f commit 6ae5e3a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/lib/puzzle/grids/penrosegrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export class PenroseGrid extends AbstractGrid {
} else {
path = points.map((p, i) => `L ${p.x} ${p.y}`).join(' ');
}
console.log('gpp', path);
return path;
})
]
Expand Down
2 changes: 1 addition & 1 deletion src/lib/puzzleWrapper/PuzzleInstanceWrapper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@
if (instance !== null) {
let gridState;
({ grid: gridState, tiles } = JSON.parse(instance));
if (grid.initialize) grid.initialize(gridState);
// if the grid was refactored and handles size differently
// then ignore the previously saved instance
if (tiles.length !== grid.total) {
tiles = [];
}
if (grid.initialize) grid.initialize(gridState);
}
}
solved = false;
Expand Down

0 comments on commit 6ae5e3a

Please sign in to comment.