Beispiel #1
0
        private void buttonFromBoardMatrix_Click(object sender, EventArgs e)
        {
            int  row    = 0;
            int  column = 0;
            bool isEndOfGame;

            for (int i = 0; i < m_ButtonsBoardSize; i++)
            {
                for (int j = 0; j < m_ButtonsBoardSize; j++)
                {
                    if (this.m_ButtonsBoardMatrix[i, j] == sender as Button)
                    {
                        row    = i + 1;
                        column = j + 1;
                    }
                }
            }

            if (m_GameManager.TurnOfBlacks == true)
            {
                isEndOfGame = m_GameManager.PlayMoveFromBoard(row, column, m_GameManager.BlackPlayer);
            }
            else
            {
                isEndOfGame = m_GameManager.PlayMoveFromBoard(row, column, m_GameManager.WhitePlayer);
            }

            showUpdatedBoardMatrix();

            if (isEndOfGame == true)
            {
                NoAvailableMovesMessage("Game over!");
                this.Close();
            }
        }