2025 Day 8 Complete
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package aoc
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
type Coordinate3d struct {
|
||||
X, Y, Z int
|
||||
@@ -71,6 +74,13 @@ func (c *Coordinate3d) GetDownCoord() *Coordinate3d {
|
||||
Z: c.Z - 1,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Coordinate3d) Distance(c2 Coordinate3d) float64 {
|
||||
return math.Sqrt(math.Pow(float64(c2.X-c.X), 2) +
|
||||
math.Pow(float64(c2.Y-c.Y), 2) +
|
||||
math.Pow(float64(c2.Z-c.Z), 2))
|
||||
}
|
||||
|
||||
func (c Coordinate3d) String() string {
|
||||
return fmt.Sprintf("[X:%d, Y:%d, Z:%d]", c.X, c.Y, c.Z)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user