Esempio n. 1
0
        public override void DoMove()
        {
            Piece.Position = To;
            Rook.Position  = RookTo;

            Piece.HasMoved = true;
            Rook.HasMoved  = true;

            Board.AfterPieceMoved(new PieceMovedCastleEventArgs(this));
        }
Esempio n. 2
0
        /// <summary>
        /// Activates the move on the <see cref="Board"/>. Should only ever be called once.
        /// </summary>
        public virtual void DoMove()
        {
            // En passant capture
            Tile diff = To - From;

            if (Piece.Type == PieceType.Pawn && diff.Abs() == Tile.UnitRC && Board[To] == null)
            {
                Tile victimPos = From + diff.ColumnOnly;
                Board.RemoveAt(victimPos);
            }

            Piece victim = Board[To];

            if (victim != null)
            {
                Board.Pieces.Remove(victim);
            }
            Piece.Position = To;

            Piece.HasMoved = true;

            Board.AfterPieceMoved(new PieceMovedEventArgs(this));
        }