diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-04 13:09:36 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:46:39 +0200 |
| commit | a907c8794f572a5b330bea1f9143887c8f2a4c4a (patch) | |
| tree | f2c507995b4776f9689df2e84c434c630682027d | |
| parent | b1421b58a4fe2c79152026d03e63c8580976b745 (diff) | |
| download | muhqs-game-a907c8794f572a5b330bea1f9143887c8f2a4c4a.tar.gz muhqs-game-a907c8794f572a5b330bea1f9143887c8f2a4c4a.zip | |
add distance > 0 assertion
| -rw-r--r-- | go/game/range.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/go/game/range.go b/go/game/range.go index 6e04d21f..bb60b54c 100644 --- a/go/game/range.go +++ b/go/game/range.go @@ -1,6 +1,7 @@ package game import ( + "log" "math" ) @@ -15,6 +16,9 @@ func DistanceBetweenPositions(origin, pos Position) int { abs = ay + math.Floor(ax/2) } + if int(abs) < 0 { + log.Fatalf("Distance smaller than 0") + } return int(abs) } |
