diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-04 13:09:36 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-02-04 13:12:55 +0100 |
| commit | 3faa4eb9dabb72fcbf2a1f6bef9717a93a732d13 (patch) | |
| tree | 37dba4bb374104cf5afd9e708aa2718888eb5e91 /go/game/range.go | |
| parent | 777252fb16dec5f0366f1529a923975b5daa9978 (diff) | |
| download | muhqs-game-3faa4eb9dabb72fcbf2a1f6bef9717a93a732d13.tar.gz muhqs-game-3faa4eb9dabb72fcbf2a1f6bef9717a93a732d13.zip | |
add distance > 0 assertion
Diffstat (limited to 'go/game/range.go')
| -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) } |
