Exemple #1
0
        /// <summary>
        /// Makes a move.
        /// </summary>
        /// <param name="move">The move to perform.</param>
        public bool MakeMove(Move move)
        {
            if (move.Execute(m_board))
            {
                switch (m_board.State.ColorToPlay)
                {
                case PieceColor.White:
                    m_clock.EndBlackTurn();
                    break;

                case PieceColor.Black:
                    m_clock.EndWhiteTurn();
                    break;
                }

                m_undoMoveHistory.Push(move);
                m_redoMoveHistory.Clear();
                HandleGameHasChanged();

                switch (m_board.State.ColorToPlay)
                {
                case PieceColor.White:
                    m_clock.BeginWhiteTurn();
                    break;

                case PieceColor.Black:
                    m_clock.BeginBlackTurn();
                    break;
                }

                return(true);
            }

            return(false);
        }