26 lines
416 B
Go
26 lines
416 B
Go
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)
|
|
}
|
|
}
|