diff --git a/src/sudoku/math.ts b/src/sudoku/math.ts index a083e74..696679b 100644 --- a/src/sudoku/math.ts +++ b/src/sudoku/math.ts @@ -166,6 +166,7 @@ export class SudokuMath { const [header, dlxRows] = this.getDLXHeader(); // complete header - no candidates removed let solutions = 0; + let updates = 0; const dlx = new DLX(header, () => ++solutions >= 2); const candidates: DNode[][] = Array.from(Array(this.values2), () => @@ -183,6 +184,7 @@ export class SudokuMath { const hasOneSolution = () => { solutions = 0; dlx.search(); + updates += dlx.updates; return solutions === 1; }; @@ -248,6 +250,7 @@ export class SudokuMath { removed.forEach((index) => { completed[index] = 0; }); + console.log("DLX updates:", updates); return completed; }