pseudo_is_legal(): use sq_is_attacked() instead of sq_attackers()
This commit is contained in:
@@ -101,7 +101,6 @@ bitboard_t sq_attackers(const pos_t *pos, const bitboard_t occ, const square_t s
|
|||||||
{
|
{
|
||||||
bitboard_t attackers = 0, tmp;
|
bitboard_t attackers = 0, tmp;
|
||||||
bitboard_t sqbb = mask(sq);
|
bitboard_t sqbb = mask(sq);
|
||||||
//bitboard_t occ = pos_occ(pos);
|
|
||||||
bitboard_t to;
|
bitboard_t to;
|
||||||
color_t opp = OPPONENT(c);
|
color_t opp = OPPONENT(c);
|
||||||
|
|
||||||
|
@@ -148,12 +148,8 @@ pos_t *move_do(pos_t *pos, const move_t move) //, state_t *state)
|
|||||||
*
|
*
|
||||||
* @return: pos.
|
* @return: pos.
|
||||||
*/
|
*/
|
||||||
pos_t *move_undo(pos_t *pos, const move_t move)//, const state_t *state)
|
pos_t *move_undo(pos_t *pos, const move_t move)
|
||||||
{
|
{
|
||||||
//# ifdef DEBUG_MOVE
|
|
||||||
//log(1, "new move: ");
|
|
||||||
//move_print(0, move, M_PR_NL | M_PR_LONG);
|
|
||||||
//# endif
|
|
||||||
color_t them = pos->turn, us = OPPONENT(them);
|
color_t them = pos->turn, us = OPPONENT(them);
|
||||||
square_t from = move_from(move), to = move_to(move);
|
square_t from = move_from(move), to = move_to(move);
|
||||||
piece_t piece = pos->board[to];
|
piece_t piece = pos->board[to];
|
||||||
|
@@ -53,10 +53,10 @@ bool pseudo_is_legal(const pos_t *pos, const move_t move)
|
|||||||
if (unlikely(from == king)) {
|
if (unlikely(from == king)) {
|
||||||
if (unlikely(is_castle(move))) {
|
if (unlikely(is_castle(move))) {
|
||||||
square_t dir = to > from? 1: -1;
|
square_t dir = to > from? 1: -1;
|
||||||
if (sq_attackers(pos, occ, from + dir, them))
|
if (sq_is_attacked(pos, occ, from + dir, them))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !sq_attackers(pos, occ ^ kingbb, to, them);
|
return !sq_is_attacked(pos, occ ^ kingbb, to, them);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (2) - King is in check
|
/* (2) - King is in check
|
||||||
|
Reference in New Issue
Block a user