Compare commits
1 Commits
e8f9c2f15d
...
99b859174f
Author | SHA1 | Date | |
---|---|---|---|
99b859174f |
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user