diff --git a/index.php b/index.php index def6bf9..e54ae4d 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,9 @@ value != "?"; + } + + function isUnknown($box) { return $box->value == "?"; } @@ -92,6 +97,7 @@ $testBoxes[] = $this->rows[8-$testBox->rowId][$testBox->columnId]; $testBoxes[] = $this->rows[$testBox->rowId][8-$testBox->columnId]; } + $testBoxes = array_filter($testBoxes, "isKnown"); $erasedValues = array(); forEach($testBoxes as $testBox) { $erasedValues[] = $testBox->value; @@ -117,7 +123,6 @@ $solutionsFound[$solution] = true; if (count($solutionsFound) > 1) { $solutionsFinder->send(true); - break; } } return count($solutionsFound) == 1;