Ejemplo n.º 1
0
        private void ButtonCellMakeAMoveClick_Click(object sender, EventArgs e)
        {
            Logic.Move move;
            string     endOfGameMessege = string.Empty;

            if (m_ChosenButton != null)
            {
                move = new B18_Ex05_Logic.Move(m_ChosenButton.CellLocation, (sender as ButtonCell).CellLocation);
                if (m_LogicGame.MakeAPlayerMove(ref move))
                {
                    updateBoard(sender as ButtonCell, move);
                    m_ChosenButton.IsClicked = false;
                    m_ChosenButton           = null;
                    if (m_LogicGame.IsGameOver(ref endOfGameMessege))
                    {
                        gameIsOver(endOfGameMessege);
                    }
                    else
                    {
                        playNextMove();
                    }
                }
                else
                {
                    MessageBox.Show("Move is not valid");
                }
            }
        }
Ejemplo n.º 2
0
 private void updateBoard(ButtonCell i_ButtonTo, Logic.Move i_Move)
 {
     ////Update Board
     setCellImageFunctionAndEnable(m_ChosenButton);
     setCellImageFunctionAndEnable(i_ButtonTo);
     if (i_Move.IsEating)
     {
         setCellImageFunctionAndEnable(m_Cells[(int)i_Move.CellEating.Row, (int)i_Move.CellEating.Column]);
     }
 }