adventofcode/2018/day10-1.go

30 lines
443 B
Go
Raw Permalink Normal View History

package main
import (
"internal/day10"
"internal/util"
)
func main() {
data := util.ReadInput()
points := day10.ParseInput(data)
2018-12-12 20:06:32 +00:00
lowest := day10.CalculateRange(points)
for {
for _, point := range points {
point.Move()
}
2018-12-12 20:06:32 +00:00
newRange := day10.CalculateRange(points)
if newRange < lowest {
lowest = newRange
} else {
for _, point := range points {
point.Reverse()
}
2018-12-12 20:06:32 +00:00
day10.DrawPoints(points)
return
}
}
}