Beispiel #1
0
        //Makes the Pawn into a queen if it has reached the end of the board
        public override void afterMoveAction(GameBoard board)
        {
            Location forwardLoc = location.Shift(0, getYForward());

            if (!board.locationOnBoard(forwardLoc))
            {
                //Perform the queen me
                Queen upgrade = new Queen(this);
                board.removePiece(this);
                board.addPiece(upgrade);
            }
        }
Beispiel #2
0
        public bool isPieceBlockingAttack(AbstractPiece piece, Location blockedAttack)
        {
            GameBoard copy = this.Copy();

            copy.removePiece(piece);//Allows for simulation

            IList <AbstractPiece> attackers = getAttackers(piece);

            foreach (AbstractPiece attacker in attackers)
            {
                MoveList moves = copy.getMoves(attacker);
                if (moves.ContainsAttacked(blockedAttack))
                {
                    return(true);
                }
            }

            return(false);
        }