Example #1
0
    public bool dfs(char[] board, int i, int count, string word)
    {
        if (count == word.Length)
        {
            return(true);
        }

        if (i < 0 || i >= board.Length || board[i] != word[count])
        {
            return(false);
        }

        char temp = board[i];

        board[i] = ' ';

        bool found = dfs(board, i + 1, count + 1, word);

        board[i] = temp;

        if (found && !currentWords.Contains(word))
        {
            currentWords.Add(word);

            GameObject academy       = GameObject.Find("AcademyCode");
            Academy    academyScript = academy.GetComponent <Academy>();
            academyScript.CheckTile(currentWords);

            ClearBlocks();
        }

        return(found);
    }