day8, part2

This commit is contained in:
efim 2023-12-08 10:07:11 +00:00
parent 3300a8bf3e
commit 38673b98ca
1 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import (
func Run() int {
fmt.Print("hello day 8")
filename := "day8/example3"
filename := "day8/input"
net, path := Read(filename)
fmt.Printf("got %+v and %+v\n", net, path)
result := GhostTraverse(net, path)
@ -84,6 +84,7 @@ func GhostTraverse(net Network, path Path) int {
}
// oh, i don't need to seed the cycle, they are already not equal
cycle := 0
for !allEqual(stepCounts) {
max := slices.Max(stepCounts)
for i, pathInfo := range pathInfos {
@ -100,7 +101,10 @@ func GhostTraverse(net Network, path Path) int {
stepCounts[i] += overJump
}
}
log.Printf("done one cycle iteration, results : %+v", stepCounts)
cycle += 1
if cycle % 10000000 == 0 {
log.Printf("done %d cycle iteration, results : %+v", cycle, stepCounts)
}
}
return stepCounts[0]