sq_is_attacked: N before P
This commit is contained in:
17
src/attack.c
17
src/attack.c
@@ -42,6 +42,15 @@ bool sq_is_attacked(const pos_t *pos, const bitboard_t occ, const square_t sq, c
|
|||||||
{
|
{
|
||||||
color_t opp = OPPONENT(c);
|
color_t opp = OPPONENT(c);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return (hyperbola_bishop_moves(occ, sq) & (pos->bb[c][BISHOP] | pos->bb[c][QUEEN])
|
||||||
|
* || hyperbola_rook_moves(occ, sq) & (pos->bb[c][ROOK] | pos->bb[c][QUEEN])
|
||||||
|
* || bb_pawn_attacks[opp][sq] & pos->bb[c][PAWN]
|
||||||
|
* || bb_knight_moves(pos->bb[c][KNIGHT], sq)
|
||||||
|
* || bb_king_moves(pos->bb[c][KING], sq)
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
|
||||||
/* bishop / queen */
|
/* bishop / queen */
|
||||||
if (hyperbola_bishop_moves(occ, sq) & (pos->bb[c][BISHOP] | pos->bb[c][QUEEN]))
|
if (hyperbola_bishop_moves(occ, sq) & (pos->bb[c][BISHOP] | pos->bb[c][QUEEN]))
|
||||||
return true;
|
return true;
|
||||||
@@ -50,14 +59,14 @@ bool sq_is_attacked(const pos_t *pos, const bitboard_t occ, const square_t sq, c
|
|||||||
if (hyperbola_rook_moves(occ, sq) & (pos->bb[c][ROOK] | pos->bb[c][QUEEN]))
|
if (hyperbola_rook_moves(occ, sq) & (pos->bb[c][ROOK] | pos->bb[c][QUEEN]))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* pawn */
|
|
||||||
if (bb_pawn_attacks[opp][sq] & pos->bb[c][PAWN])
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* knight */
|
/* knight */
|
||||||
if (bb_knight_moves(pos->bb[c][KNIGHT], sq))
|
if (bb_knight_moves(pos->bb[c][KNIGHT], sq))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
/* pawn */
|
||||||
|
if (bb_pawn_attacks[opp][sq] & pos->bb[c][PAWN])
|
||||||
|
return true;
|
||||||
|
|
||||||
/* king */
|
/* king */
|
||||||
if (bb_king_moves(pos->bb[c][KING], sq))
|
if (bb_king_moves(pos->bb[c][KING], sq))
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user