private static IEnumerable <string> GetPossibleSolutionsForHint(ITrie wordTrie, char?[,] characterMatrix, Hint hint) { List <string> possibleSolutions = new List <string>(); //string hintString = string.Empty; //if (hint.IsOcrCandidate) //{ // IEnumerable<string> hintCharacters = ocrProcessor.GetCharactersFromImage(hint.OcrCandidate); // hintString = string.Join("", hintCharacters); //} //Node currentNode = wordTrie.Prefix(hintString); //HintLocation startingPoint = GetStartingPoint(characterMatrix, hintString); //if (startingPoint.IsFoundInMatrix) //{ //} int matrixRows = characterMatrix.GetLength(0); int matrixCols = characterMatrix.GetLength(1); for (int rows = 0; rows < matrixRows; rows++) { for (int cols = 0; cols < matrixCols; cols++) { string currentValue = characterMatrix[rows, cols].ToString(); Move initialMove = new Move(currentValue, 1, new Location(rows, cols)); Queue <Move> moveQueue = new Queue <Move>(); moveQueue.Enqueue(initialMove); while (moveQueue.Count > 0) { Move currentMove = moveQueue.Dequeue(); currentMove.Parent?.VisitChild(currentMove); if (wordTrie.WordExists(currentMove.Value)) { if (currentMove.Depth == hint.HintSize && wordTrie.IsFullWord(currentMove.Value)) { possibleSolutions.Add(currentMove.Value); SqueezeMatrix(characterMatrix, currentMove.GetTraversedLocations()); continue; } IEnumerable <Move> availableMoves = GetAvailableMoves(currentMove, characterMatrix); foreach (Move availableMove in availableMoves) { currentMove.AddChild(availableMove); moveQueue.Enqueue(availableMove); } } } } } return(possibleSolutions); }