Discussion of chess software programming and technical issues.
Moderators: hgm , Rebel , chrisw
xr_a_y
Posts: 1871 Joined: Sat Nov 25, 2017 2:28 pm
Location: France
Post
by xr_a_y » Sat May 25, 2019 6:39 pm
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 ?
RubiChess
Posts: 584 Joined: Fri Mar 30, 2018 7:20 am
Full name: Andreas Matthies
Post
by RubiChess » Sat May 25, 2019 6:54 pm
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
Last edited by RubiChess on Sat May 25, 2019 6:56 pm, edited 1 time in total.
xr_a_y
Posts: 1871 Joined: Sat Nov 25, 2017 2:28 pm
Location: France
Post
by xr_a_y » Sat May 25, 2019 6:56 pm
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
Code: Select all
inline Bitboard operator&( Bitboard b, Square s) { return b & square_bb(s); }