adventofcode/2018/day03-2.go
2018-12-03 16:53:58 -05:00

35 lines
559 B
Go

package main
import (
"fmt"
"internal/fabric"
"internal/util"
)
func main() {
data := util.ReadInput()
claims, maxX, maxY := fabric.ParseClaims(data)
fabric.PopulateGrid(claims, maxX, maxY) // ignoring return value because we only want the side effect here
id := -1
count := 0
for _, claim := range claims {
if !claim.Overlaps {
id = claim.ID
count++
}
}
if count > 1 {
fmt.Printf("%d claims detected no overlap. :(\n", count)
return
}
if count == 0 {
fmt.Println("All claims overlapped. :(")
return
}
fmt.Println(id)
}