adventofcode/2018/internal/day08/debug.go

26 lines
416 B
Go
Raw Normal View History

2018-12-11 01:23:18 +00:00
package day08
import (
"fmt"
)
func DebugPrintTree(root *Node) {
debugPrintTreeR(root, 0)
}
func debugPrintTreeR(node *Node, indent int) {
for i := 0; i < indent; i++ {
fmt.Printf(" ")
}
fmt.Printf("Children: %d | Metadata: ", len(node.Children))
for _, md := range node.Metadata {
fmt.Printf("%d ", md)
}
fmt.Println()
for _, child := range node.Children {
debugPrintTreeR(child, indent+1)
}
}