コード例 #1
0
        public void ApplyReverseMove(Move move)
        {
            Owner owner = PreviousPlayer;

            if (PieceGrid.PointPieces[move.AmazonsPoint].Owner != owner)
            {
                throw new ArgumentException($"Reverse move given doesn't correspond to {owner} previous turn. Move: {move}");
            }
            if (PieceGrid.PointPieces[move.AmazonsPoint].Name != PieceName.Amazon)
            {
                throw new ArgumentException($"Reverse move given isn't on an Amazon. You cannot move a {PieceGrid.PointPieces[move.Origin].Name}. Move: {move}");
            }

            PieceGrid.ApplyReverseMove(move);

            if (owner == Owner.Player1)
            {
                Player1MoveCount--;
            }
            else
            {
                Player2MoveCount--;
            }

            _moves.Clear();
        }