]> git.localhorst.tv Git - alttp.git/commitdiff
fix scoring
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 29 Feb 2024 22:47:32 +0000 (23:47 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 29 Feb 2024 22:47:32 +0000 (23:47 +0100)
app/Models/Channel.php

index d7d307e5294b4f6368f066d0c61ae18f8b39b1dc..da9f6a7360ad772002d0b1307cd751853c77314b 100644 (file)
@@ -81,6 +81,9 @@ class Channel extends Model {
                                $distance = abs(intval($guess->guess) - intval($solution));
                                if (is_null($min_distance) || $distance == $min_distance) {
                                        $candidates[] = $guess;
+                                       if (is_null($min_distance)) {
+                                               $min_distance = $distance;
+                                       }
                                } else if ($distance < $min_distance) {
                                        $candidates = [$guess];
                                        $min_distance = $distance;