diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2024-07-28 18:38:09 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2024-07-28 18:38:09 +0200 |
| commit | 97f4d544d9ad0b80edd44d248867213250700240 (patch) | |
| tree | 764babd7325c6ea6fc0b73d6713c7b366dc426ad /ride/climb.go | |
| parent | c3c8381b5d376263f4b14ea3e5328f7ab8ad2142 (diff) | |
fix: One more iteration to find the best climb
Diffstat (limited to 'ride/climb.go')
| -rw-r--r-- | ride/climb.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ride/climb.go b/ride/climb.go index 3b3d6dc..cff2b39 100644 --- a/ride/climb.go +++ b/ride/climb.go @@ -79,6 +79,13 @@ func bestClimbBetween(points []Point, start int, end int) Climb { bestScore = score } } + for i := bestStart; i < bestEnd; i++ { + score := Score(points, i, bestEnd) + if score > bestScore { + bestStart = i + bestScore = score + } + } climb := Climb{bestStart, bestEnd} kcore.Assert(climb.start < climb.end, "empty climb") |