Exemple #1
0
        private static bool checkSecondaryDiagonal(Board i_Board)
        {
            bool        isThereASequence = true;
            byte        row = 0;
            byte        col = (byte)(i_Board.Size - 1);
            eCellValues firstValChecked;

            if (i_Board[row, col].Value.Text != string.Empty)
            {
                firstValChecked = (eCellValues)Enum.Parse(typeof(eCellValues), i_Board[row, col].Value.Text);
                while (row + 1 < i_Board.Size)
                {
                    row++;
                    col--;
                    if (firstValChecked.ToString() != i_Board[row, col].Value.Text)
                    {
                        isThereASequence = false;
                        break;
                    }
                }

                if (isThereASequence)
                {
                    s_WinnerSign = firstValChecked;
                }
            }
            else
            {
                isThereASequence = false;
            }

            return(isThereASequence);
        }
Exemple #2
0
        private static bool checkRow(Board i_Board, byte i_Row)
        {
            bool        isThereASequence = true;
            eCellValues firstValChecked;

            if (i_Board[i_Row, 0].Value.Text != string.Empty)
            {
                firstValChecked = (eCellValues)Enum.Parse(typeof(eCellValues), i_Board[i_Row, 0].Value.Text);
                for (byte i = 1; i < i_Board.Size; i++)
                {
                    if (firstValChecked.ToString() != i_Board[i_Row, i].Value.Text)
                    {
                        isThereASequence = false;
                        break;
                    }
                }

                if (isThereASequence)
                {
                    s_WinnerSign = firstValChecked;
                }
            }
            else
            {
                isThereASequence = false;
            }

            return(isThereASequence);
        }