This is even better, but still not fast enough.

This commit is contained in:
Anna Rose Wiggins 2018-12-13 00:51:19 -05:00
parent 5d4757d4cb
commit bab5f879b0
No known key found for this signature in database
GPG key ID: 8D9ACA841015C59A
3 changed files with 37 additions and 22 deletions

View file

@ -12,13 +12,14 @@ const NumGenerations = 50000000000
func main() {
data := util.ReadInput()
plants, rules := day12.FastParseInput(data)
rootIndex := 0
runner := day12.FastGenerationRunner()
rootIndex := 0
for i := 0; i < NumGenerations; i++ {
plants, rootIndex = day12.FastRunGeneration(plants, rules, rootIndex)
plants, rootIndex = runner(plants, rules, rootIndex)
// debug
if i%1000000 == 0 {
if i%1000000000 == 0 {
fmt.Println("DEBUG: Generation: ", i)
}
}