/// <summary> /// Find all words in the sub-tree from here /// </summary> /// <param name="node">The node in the LetterGrid that should align with this node in the dictionary tree</param> /// <param name="allowMultiWords">Allow matches which are made up of multiple words</param> /// <param name="soln">A partial solution to start with</param> public void FindAllWords(GridNode node, bool allowMultiWords, Solutions.PartialSoln soln = null) { node.Use(); if (_isWord) { if (allowMultiWords) { if (!node.ParentGrid.CheckForMandatoryNodes()) { if (soln == null) { soln = new Solutions.PartialSoln(); } this.Root.FindAllWords(node, true, new Solutions.PartialSoln(soln, this.ToString())); } else { if (soln == null) { Solutions.AddWord(this.ToString()); } else { Solutions.AddWord(new Solutions.PartialSoln(soln, this.ToString())); } } } else if (_depth >= (Properties.Settings.Default.MinWordLength - 1) && node.IsUsed && node.ParentGrid.CheckForMandatoryNodes()) { Solutions.AddWord(this.ToString()); } } foreach (GridNode n in node.GetAdjacentNodes()) { if (!n.IsUsed) { foreach (DictNode n2 in Children) { if (n.GetLetter() == n2.LetterEnum) { n2.FindAllWords(n, allowMultiWords, new Solutions.PartialSoln(soln)); n.Release(); break; } } } } }