示例#1
0
        public void PlayRound(Move i_MoveToApply)
        {
            if (isMoveValid(i_MoveToApply))
            {
                const bool v_OnlyCaptureMoves = true;
                eAction    lastAction         = applyMove(i_MoveToApply);
                r_CurrentlyLegalMoves.Clear();
                m_LastMovingPiece.AddLegalMovesToList(r_CurrentlyLegalMoves, m_CheckersBoard, v_OnlyCaptureMoves);
                if (lastAction == eAction.Capture && r_CurrentlyLegalMoves.Any())
                {
                    // the player keeping the turn, but we update that it will not be the first move, as in series of capture moves
                    m_FirstMoveThisTurn = false;
                }
                else
                {
                    // turn goes to the next player
                    m_CurrPlayerTurn    = enemyPlayer(m_CurrPlayerTurn);
                    m_FirstMoveThisTurn = true;
                    if (!m_CurrPlayerTurn.Human)
                    {
                        makeMachineMove();
                    }
                }

                if (gameOver())
                {
                    handleGameOver();
                }
            }
            else
            {
                OnInvalidMoveGiven(new EventArgs());     // show prompt dialog "Move is not Valid"
            }
        }