adventofcode/2018/day12-2.go

29 lines
482 B
Go

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