public void ListKnownAblilities(TalentTreeNode node) { if (node != null) { if (node.Learned) { ListKnownAblilities(node.Left); Console.WriteLine(node.Name); ListKnownAblilities(node.Right); } } }
static void Main(string[] args) { TalentTreeNode newTree = new TalentTreeNode("Javascript", true); newTree.Left = new TalentTreeNode("C#", true); newTree.Right = new TalentTreeNode("C++", true); newTree.Left.Left = new TalentTreeNode("Processing", false); newTree.Left.Right = new TalentTreeNode("P5.js", false); newTree.Right.Left = new TalentTreeNode("Machine Learning", false); newTree.Right.Right = new TalentTreeNode("Ethical Hacking", true); newTree.ListKnownAblilities(newTree); newTree.ListPossibleKnowAbilities(newTree); }
public void ListPossibleKnowAbilities(TalentTreeNode node) { if (node != null) { if (node.Learned == false) { Console.WriteLine(node.Name); } else { ListPossibleKnowAbilities(node.Left); ListPossibleKnowAbilities(node.Right); } } }