adventofcode/2018/day10-2.go

32 lines
397 B
Go

package main
import (
"fmt"
"internal/day10"
"internal/util"
)
func main() {
data := util.ReadInput()
points := day10.ParseInput(data)
lowest := day10.CalculateRange(points)
i := 0
for {
for _, point := range points {
point.Move()
}
newRange := day10.CalculateRange(points)
if newRange < lowest {
lowest = newRange
} else {
fmt.Println(i)
return
}
i++
}
}