Browse Source

Update calc

master
xyrex 4 years ago
parent
commit
482f54ee14
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      strategies/common.go

+ 2
- 2
strategies/common.go View File

@@ -14,13 +14,13 @@ const (
)

func calculateDistanceCeiling(source *models.Star, target *models.Star) int {
squareDist := ((source.X - target.X) * (source.X - target.X)) + ((source.Y - target.Y) * (source.Y - target.Y))
squareDist := (source.X - target.X) * (source.X - target.X) + int(source.Y - target.Y) * (source.Y - target.Y)

lb := 1
ub := 300 * 2
for lb < ub {
mb := (lb + ub) / 2
if mb*mb >= squareDist {
if int(mb*mb) >= squareDist {
ub = mb
} else {
lb = mb + 1

Loading…
Cancel
Save