aboutsummaryrefslogtreecommitdiff
path: root/go/game/range.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/range.go')
-rw-r--r--go/game/range.go14
1 files changed, 1 insertions, 13 deletions
diff --git a/go/game/range.go b/go/game/range.go
index 8b57fb1b..c98e1c44 100644
--- a/go/game/range.go
+++ b/go/game/range.go
@@ -27,20 +27,8 @@ func DistanceBetweenPermanents(p1, p2 Permanent) int {
}
func IsPositionInRange(origin Position, pos Position, r int) bool {
- x, y := float64(pos.X-origin.X), float64(pos.Y-origin.Y)
- ax, ay := math.Abs(x), math.Abs(y)
- if ax > float64(r) || ay > float64(r) {
- return false
- }
-
- var abs float64
- if pos.X > pos.Y {
- abs = ax + math.Floor(ay/2)
- } else {
- abs = ay + math.Floor(ax/2)
- }
- return abs <= float64(r)
+ return DistanceBetweenPositions(origin, pos) <= r
}
func PositionsInRange(origin Position, r int, includeOrigin bool) []Position {