Exemplo n.º 1
0
        public bool CanMoveTo(ChessBoard board, BoardTile tile)
        {
            // By putting this code here we check whether or not the king will be attacked if we move,
            // and also checks what spots we CAN move to when the king is under attack.
            if (OccupyingPiece.WillKingBeAttackedIfMovedTo(board, this, tile))
            {
                return(false);
            }

            if (OccupyingPiece != null)
            {
                return(OccupyingPiece.CanMoveTo(board, this, tile));
            }

            return(false);
        }