adventofcode/2018/day10-2.go

32 lines
397 B
Go
Raw Normal View History

2018-12-12 20:06:32 +00:00
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++
}
}