示例#1
0
        private void handleComputerMove()
        {
            Move choosenMove;

            m_latstmove  = string.Format("{0}'s move was ({1}):", m_game.Player[(int)m_game.PlayerTurn].Name, (char)m_game.Player[(int)m_game.PlayerTurn].PlayerSign);
            choosenMove  = m_game.MakeACpmputerMove();
            m_latstmove += string.Format("{0}{1}>{2}{3}", makeEnumColumnToChar(choosenMove.CellFrom.Column), makeEnumRowsToChar(choosenMove.CellFrom.Row), makeEnumColumnToChar(choosenMove.CellTo.Column), makeEnumRowsToChar(choosenMove.CellTo.Row));
        }
示例#2
0
        private void playNextMove()
        {
            string endOfGameMessege = string.Empty;

            Logic.Move computerMove;
            ButtonCell buttonTo;

            if (m_LogicGame.Player[(int)m_LogicGame.PlayerTurn].IsComputer)
            {
                while (m_LogicGame.PlayerTurn == Logic.EnumPlayerTurn.enumPlayerTurn.SecondPlayer)
                {
                    computerMove   = m_LogicGame.MakeACpmputerMove();
                    m_ChosenButton = m_Cells[(int)computerMove.CellFrom.Row, (int)computerMove.CellFrom.Column];
                    buttonTo       = m_Cells[(int)computerMove.CellTo.Row, (int)computerMove.CellTo.Column];
                    updateBoard(buttonTo, computerMove);
                }
            }

            if (m_LogicGame.IsGameOver(ref endOfGameMessege))
            {
                gameIsOver(endOfGameMessege);
            }
        }