Files
bwinf-nasserhund/structs.go
2025-11-12 22:17:04 +01:00

27 lines
396 B
Go

package main
import "math"
type Coordinate struct {
x, y int
}
type Path struct {
start, end Coordinate
}
type Pond struct {
vertices []Coordinate
}
type Map struct {
paths []Path
ponds []Pond
}
func (current Coordinate) distance(other Coordinate) float64 {
dx := math.Abs(float64(current.x - other.x))
dy := math.Abs(float64(current.y - other.y))
return math.Sqrt(dx*dx + dy*dy)
}