Can the parent node be a penguin or only child nodes? So, if a node is found that IS a penguin you want to pass that count up the chain, ELSE you want to pass 0 up the chain. Correct? So, in the end you return the sum of penguin nodes.Michael Grünau wrote:I don't want to count every node. I only want to count the node if there is a penguin inside so: penguin != null .
Show us how you'd do that.Michael Grünau wrote:Exactly, and if it is a penguin we want to add +1 to the count...
No, you always want to sum up the count of the children otherwise you wouldn't be counting their penguins....and if not just check if the children are a penguin.
Apology acceptedMichael Grünau wrote:Sorry. . .
A new post would be better.. . . it is always better to provide some code . . .
Consider Paul's rocket mass heater. |