adventofcode/2018/day23/coord.go
Brian Buller 1ec6280623 2018 Day 23*
Had to find someone else's python solution to get an answer.
Need to pull it apart and figure out what's wrong with my solution.
2019-11-07 15:43:14 -06:00

19 lines
264 B
Go

package main
type Coordinate struct {
X, Y, Z int
}
var Zero = Coordinate{X: 0, Y: 0, Z: 0}
func (c Coordinate) Distance(a Coordinate) int {
return abs(c.X-a.X) + abs(c.Y-a.Y) + abs(c.Z-a.Z)
}
func abs(v int) int {
if v < 0 {
return v * -1
}
return v
}