adventofcode/2018/day12-2.go

28 lines
456 B
Go

package main
import (
"fmt"
"internal/day12"
"internal/util"
)
const NumGenerations = 50000000000
func main() {
data := util.ReadInput()
plants, rules := day12.FastParseInput(data)
rootIndex := 0
for i := 0; i < NumGenerations; i++ {
plants, rootIndex = day12.FastRunGeneration(plants, rules, rootIndex)
// debug
if i%1000000 == 0 {
fmt.Println("DEBUG: Generation: ", i)
}
}
fmt.Println(day12.FastSumPlants(plants, rootIndex))
}