fix generator
This commit is contained in:
parent
de1e08b52b
commit
e2fdee4173
@ -86,7 +86,7 @@
|
|||||||
array_unset_value($box->value, $neighbour->allowedValues);
|
array_unset_value($box->value, $neighbour->allowedValues);
|
||||||
}
|
}
|
||||||
// Fill grid
|
// Fill grid
|
||||||
$this->findSolutions(true, 1, 4)->current();
|
$this->findSolutions(true)->current();
|
||||||
|
|
||||||
// Remove clues while there is still a unique solution
|
// Remove clues while there is still a unique solution
|
||||||
shuffle($this->boxes);
|
shuffle($this->boxes);
|
||||||
@ -110,9 +110,9 @@
|
|||||||
if ($this->isValid()) {
|
if ($this->isValid()) {
|
||||||
$nbClues -= count($testBoxes);
|
$nbClues -= count($testBoxes);
|
||||||
} else {
|
} else {
|
||||||
forEach($testBoxes as $i => $box) {
|
forEach($testBoxes as $i => $testBox) {
|
||||||
$box->value = $erasedValues[$i];
|
$testBox->value = $erasedValues[$i];
|
||||||
forEach($box->neighbourhood as $neighbour) array_unset_value($box->value, $neighbour->allowedValues);
|
forEach($testBox->neighbourhood as $neighbour) array_unset_value($testBox->value, $neighbour->allowedValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user