Partial solution for 10.1. We've got grouping, but still need sorting and some printing cleanup.
This commit is contained in:
parent
06a0886b67
commit
e47b6c4a45
6 changed files with 328 additions and 0 deletions
37
2018/day10-1.go
Normal file
37
2018/day10-1.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"internal/day10"
|
||||
"internal/util"
|
||||
)
|
||||
|
||||
func main() {
|
||||
data := util.ReadInput()
|
||||
points := day10.ParseInput(data)
|
||||
|
||||
i := 0 // debug
|
||||
for {
|
||||
for _, point := range points {
|
||||
point.Move()
|
||||
}
|
||||
|
||||
groups := day10.GroupPoints(points)
|
||||
if groups != nil {
|
||||
for _, group := range groups {
|
||||
day10.DrawPoints(group)
|
||||
fmt.Println()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// debug
|
||||
i++
|
||||
if i > 100000 {
|
||||
fmt.Println("oops")
|
||||
return
|
||||
}
|
||||
// end debug
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue