Return blank array when requested clues == 0

This commit is contained in:
Matt Low 2021-03-04 21:35:25 -07:00
parent 8526dcd083
commit 4e6cdab9ee

View File

@ -158,6 +158,10 @@ export class SudokuMath {
} }
generate(clues: number, attempts = Infinity, totalTime = Infinity) { generate(clues: number, attempts = Infinity, totalTime = Infinity) {
if (clues === 0) {
return Array(this.values2).fill(0);
}
let [completed, updates] = this.generateComplete(); let [completed, updates] = this.generateComplete();
const [header, dlxRows] = this.getDLXHeader(); // complete header - no candidates removed const [header, dlxRows] = this.getDLXHeader(); // complete header - no candidates removed