2025 Day 8 Complete

This commit is contained in:
2025-12-08 13:28:53 -06:00
parent c16210ae92
commit d10e9f9a9a
5 changed files with 1254 additions and 1 deletions

View File

@@ -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)
}