Exemple #1
0
 private void clearCurrentGameBoard()
 {
     this.tableLayoutPanel1.Controls.Clear();
     this.PlayerArray[0].m_ValidMoves.Clear();
     this.PlayerArray[1].m_ValidMoves.Clear();
     BoardState.m_BlackPositionList.Clear();
     BoardState.m_WhitePositionList.Clear();
     BoardState.InitDemiBoard(this.m_BoardSize);
     BoardState.CheckOptionalMoves(this.PlayerArray[0].m_ValidMoves, this.PlayerArray[1].m_ValidMoves);
 }
Exemple #2
0
 private void buttonComputer_Click(object sender, EventArgs e)
 {
     this.m_GameForm.PlayerArray = this.m_MenuSetting.SetPlayers((int)MainMenu.eOpponentOption.Computer);
     BoardState.InitDemiBoard(this.m_BoardSize);
     BoardState.CheckOptionalMoves(this.m_GameForm.PlayerArray[0].m_ValidMoves, this.m_GameForm.PlayerArray[1].m_ValidMoves);
     this.Close();
     this.Hide();
     this.m_GameForm.BoardSize = this.m_BoardSize;
     this.m_GameForm.ShowDialog();
 }
Exemple #3
0
        private void updateGameBoardForm(char[,] i_DemiBoard)
        {
            for (int i = 0; i < i_DemiBoard.GetLength(0); i++)
            {
                for (int j = 0; j < i_DemiBoard.GetLength(0); j++)
                {
                    if (i_DemiBoard[i, j] == 0)
                    {
                        this.tableLayoutPanel1.Controls[(this.m_BoardSize * j) + i].BackColor = SystemColors.Control;
                    }
                    else if (i_DemiBoard[i, j] == 'X')
                    {
                        this.tableLayoutPanel1.Controls[(this.m_BoardSize * j) + i].BackgroundImage = Properties.Resources.CoinRed;
                    }
                    else if (i_DemiBoard[i, j] == 'O')
                    {
                        this.tableLayoutPanel1.Controls[(this.m_BoardSize * j) + i].BackgroundImage = Properties.Resources.CoinYellow;
                    }

                    if (this.tableLayoutPanel1.Controls[(this.m_BoardSize * j) + i].BackColor == Color.Green)
                    {
                        this.tableLayoutPanel1.Controls[(this.m_BoardSize * j) + i].BackColor = SystemColors.Control;
                    }

                    this.tableLayoutPanel1.Controls[(this.m_BoardSize * j) + i].Enabled = false;
                }
            }

            this.switchTurn();
            this.removeValidMoves(this.PlayerArray[0].m_ValidMoves);
            this.removeValidMoves(this.PlayerArray[1].m_ValidMoves);

            this.PlayerArray[0].m_ValidMoves.Clear();
            this.PlayerArray[1].m_ValidMoves.Clear();

            BoardState.CheckOptionalMoves(this.PlayerArray[0].m_ValidMoves, this.PlayerArray[1].m_ValidMoves);

            if (this.PlayerArray[1].UserType != Player.eUserType.Computer || !this.PlayerArray[1].IsMyTurn)
            {
                this.drawCurrentPlayerValidMoves();
            }
        }