2018-12-12 18:18:53 +00:00
|
|
|
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)
|
2018-12-12 18:18:53 +00:00
|
|
|
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 18:18:53 +00:00
|
|
|
}
|
2018-12-12 20:06:32 +00:00
|
|
|
day10.DrawPoints(points)
|
2018-12-12 18:18:53 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|