cmd: send group

This commit is contained in:
Ilia Denisov
2026-01-04 21:43:16 +02:00
parent c6e1cb5cdf
commit a6093a1c29
12 changed files with 266 additions and 15 deletions
+2 -10
View File
@@ -2,10 +2,10 @@ package generator
import (
"fmt"
"math"
"math/rand"
"github.com/iliadenisov/galaxy/internal/generator/plotter"
"github.com/iliadenisov/galaxy/internal/util"
)
type Map struct {
@@ -58,15 +58,7 @@ func (m Map) NewCoordinate(deadZoneRaduis float64) (Coordinate, error) {
}
func (m Map) ShortDistance(from, to Coordinate) float64 {
dx := math.Abs(to.X - from.X)
dy := math.Abs(to.Y - from.Y)
if dx > float64(m.Width/2) {
dx = float64(m.Width) - dx
}
if dy > float64(m.Height/2) {
dy = float64(m.Height) - dy
}
return math.Sqrt(math.Pow(dx, 2) + math.Pow(dy, 2))
return util.ShortDistance(m.Width, m.Height, from.X, from.Y, to.X, to.Y)
}
// RandI returns a random float64 value between min and max