Esempio n. 1
0
    static bool FindGameOver(Letter letterPlayed, Letter[] grid, out GameResult result)
    {
        for (int line = 0; line < 8; line++)
        {
            gm.CheckLine(letterPlayed, grid, line, out int goodBoxes, out _, out _);
            if (goodBoxes == 3)
            {
                result = GameResult.Win;
                return(true);
            }
        }
        bool noBlankSpaces = true;

        foreach (Letter box in grid)
        {
            if (box == Letter.Blank)
            {
                noBlankSpaces = false;
            }
        }
        if (noBlankSpaces)
        {
            result = GameResult.Draw;
            return(true);
        }
        result = GameResult.Draw;
        return(false);
    }