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
|
const [header, dlxRows] = this.getDLXHeader(); // complete header - no candidates removed
|
||||||
|
|
||||||
let solutions = 0;
|
let solutions = 0;
|
||||||
|
let updates = 0;
|
||||||
const dlx = new DLX(header, () => ++solutions >= 2);
|
const dlx = new DLX(header, () => ++solutions >= 2);
|
||||||
|
|
||||||
const candidates: DNode[][] = Array.from(Array(this.values2), () =>
|
const candidates: DNode[][] = Array.from(Array(this.values2), () =>
|
||||||
@ -183,6 +184,7 @@ export class SudokuMath {
|
|||||||
const hasOneSolution = () => {
|
const hasOneSolution = () => {
|
||||||
solutions = 0;
|
solutions = 0;
|
||||||
dlx.search();
|
dlx.search();
|
||||||
|
updates += dlx.updates;
|
||||||
return solutions === 1;
|
return solutions === 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -248,6 +250,7 @@ export class SudokuMath {
|
|||||||
removed.forEach((index) => {
|
removed.forEach((index) => {
|
||||||
completed[index] = 0;
|
completed[index] = 0;
|
||||||
});
|
});
|
||||||
|
console.log("DLX updates:", updates);
|
||||||
return completed;
|
return completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user