From dc4019f7a7aa5ba98964e52e481d9d22ed080f3c Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 29 Feb 2024 23:47:32 +0100 Subject: [PATCH] fix scoring --- app/Models/Channel.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Models/Channel.php b/app/Models/Channel.php index d7d307e..da9f6a7 100644 --- a/app/Models/Channel.php +++ b/app/Models/Channel.php @@ -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; -- 2.39.2