Brian Buller
1ec6280623
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.
19 lines
264 B
Go
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
|
|
}
|