Page 1 of 1

bug or not

Posted: Sat May 25, 2019 6:39 pm
by xr_a_y
Reading Stockfish KPK code today, I found this

Code: Select all

 // Immediate win if a pawn can be promoted without getting captured
    else if (   us == WHITE
             && rank_of(psq) == RANK_7
             && ksq[us] != psq + NORTH
             && (    distance(ksq[~us], psq + NORTH) > 1
                 || (PseudoAttacks[KING][ksq[us]] & (psq + NORTH))))
        result = WIN;
where a Bitboard PseudoAttacks[][] is used (&) with a Square psq. Isn't this a bug ?

Re: bug or not

Posted: Sat May 25, 2019 6:54 pm
by RubiChess
SF code uses overloading operators in several places and this is one of them:

...
inline Bitboard operator&( Bitboard b, Square s) { return b & square_bb(s); }
---

Andreas

Re: bug or not

Posted: Sat May 25, 2019 6:56 pm
by xr_a_y
RubiChess wrote: Sat May 25, 2019 6:54 pm SF code uses overloading operators in several places. I guess this is one of them.

Andreas
Thanks ! this is pretty :wink:

Code: Select all

inline Bitboard  operator&( Bitboard  b, Square s) { return b &  square_bb(s); }