Add Files of first version
This commit is contained in:
26
structs.go
Normal file
26
structs.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user