mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Do not pass pinned argument in Position::move_is_check()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
734941672e
commit
c6630abe0d
3 changed files with 10 additions and 18 deletions
|
@ -536,29 +536,19 @@ bool Position::pl_move_is_legal(Move m) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Position::move_is_check() tests whether a pseudo-legal move is a check.
|
/// Position::move_is_check() tests whether a pseudo-legal move is a check
|
||||||
/// There are two versions of this function: One which takes only a move as
|
|
||||||
/// input, and one which takes a move and a bitboard of discovered check
|
|
||||||
/// candidates. The latter function is faster, and should always be preferred
|
|
||||||
/// when a discovered check candidates bitboard has already been computed.
|
|
||||||
|
|
||||||
bool Position::move_is_check(Move m) const {
|
bool Position::move_is_check(Move m) const {
|
||||||
|
|
||||||
Bitboard dc = discovered_check_candidates(side_to_move());
|
|
||||||
return move_is_check(m, dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Position::move_is_check(Move m, Bitboard dcCandidates) const {
|
|
||||||
|
|
||||||
assert(is_ok());
|
assert(is_ok());
|
||||||
assert(move_is_ok(m));
|
assert(move_is_ok(m));
|
||||||
assert(dcCandidates == discovered_check_candidates(side_to_move()));
|
|
||||||
|
|
||||||
Color us = side_to_move();
|
Color us = side_to_move();
|
||||||
Color them = opposite_color(us);
|
Color them = opposite_color(us);
|
||||||
Square from = move_from(m);
|
Square from = move_from(m);
|
||||||
Square to = move_to(m);
|
Square to = move_to(m);
|
||||||
Square ksq = king_square(them);
|
Square ksq = king_square(them);
|
||||||
|
Bitboard dcCandidates = discovered_check_candidates(us);
|
||||||
|
|
||||||
assert(color_of_piece_on(from) == us);
|
assert(color_of_piece_on(from) == us);
|
||||||
assert(piece_on(ksq) == piece_of_color_and_type(them, KING));
|
assert(piece_on(ksq) == piece_of_color_and_type(them, KING));
|
||||||
|
|
|
@ -221,7 +221,6 @@ public:
|
||||||
// Properties of moves
|
// Properties of moves
|
||||||
bool pl_move_is_legal(Move m) const;
|
bool pl_move_is_legal(Move m) const;
|
||||||
bool move_is_check(Move m) const;
|
bool move_is_check(Move m) const;
|
||||||
bool move_is_check(Move m, Bitboard dcCandidates) const;
|
|
||||||
bool move_is_capture(Move m) const;
|
bool move_is_capture(Move m) const;
|
||||||
bool move_is_deep_pawn_push(Move m) const;
|
bool move_is_deep_pawn_push(Move m) const;
|
||||||
bool move_is_pawn_push_to_7th(Move m) const;
|
bool move_is_pawn_push_to_7th(Move m) const;
|
||||||
|
|
|
@ -996,7 +996,7 @@ namespace {
|
||||||
assert(move_is_ok(move));
|
assert(move_is_ok(move));
|
||||||
|
|
||||||
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
||||||
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
|
bool moveIsCheck = pos.move_is_check(move);
|
||||||
bool moveIsCapture = pos.move_is_capture(move);
|
bool moveIsCapture = pos.move_is_capture(move);
|
||||||
|
|
||||||
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
||||||
|
@ -1298,7 +1298,7 @@ namespace {
|
||||||
assert(move_is_ok(move));
|
assert(move_is_ok(move));
|
||||||
|
|
||||||
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
bool singleReply = (isCheck && mp.number_of_moves() == 1);
|
||||||
bool moveIsCheck = pos.move_is_check(move, dcCandidates);
|
bool moveIsCheck = pos.move_is_check(move);
|
||||||
bool moveIsCapture = pos.move_is_capture(move);
|
bool moveIsCapture = pos.move_is_capture(move);
|
||||||
|
|
||||||
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
movesSearched[moveCount++] = ss[ply].currentMove = move;
|
||||||
|
@ -1489,7 +1489,7 @@ namespace {
|
||||||
&& !isCheck
|
&& !isCheck
|
||||||
&& !pvNode
|
&& !pvNode
|
||||||
&& !move_promotion(move)
|
&& !move_promotion(move)
|
||||||
&& !pos.move_is_check(move, dcCandidates)
|
&& !pos.move_is_check(move)
|
||||||
&& !pos.move_is_passed_pawn_push(move))
|
&& !pos.move_is_passed_pawn_push(move))
|
||||||
{
|
{
|
||||||
Value futilityValue = staticValue
|
Value futilityValue = staticValue
|
||||||
|
@ -1583,8 +1583,9 @@ namespace {
|
||||||
&& (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
|
&& (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
|
||||||
{
|
{
|
||||||
assert(move_is_ok(move));
|
assert(move_is_ok(move));
|
||||||
|
assert(pos.discovered_check_candidates(pos.side_to_move()) == sp->dcCandidates);
|
||||||
|
|
||||||
bool moveIsCheck = pos.move_is_check(move, sp->dcCandidates);
|
bool moveIsCheck = pos.move_is_check(move);
|
||||||
bool moveIsCapture = pos.move_is_capture(move);
|
bool moveIsCapture = pos.move_is_capture(move);
|
||||||
|
|
||||||
lock_grab(&(sp->lock));
|
lock_grab(&(sp->lock));
|
||||||
|
@ -1694,7 +1695,9 @@ namespace {
|
||||||
&& !thread_should_stop(threadID)
|
&& !thread_should_stop(threadID)
|
||||||
&& (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
|
&& (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
|
||||||
{
|
{
|
||||||
bool moveIsCheck = pos.move_is_check(move, sp->dcCandidates);
|
assert(pos.discovered_check_candidates(pos.side_to_move()) == sp->dcCandidates);
|
||||||
|
|
||||||
|
bool moveIsCheck = pos.move_is_check(move);
|
||||||
bool moveIsCapture = pos.move_is_capture(move);
|
bool moveIsCapture = pos.move_is_capture(move);
|
||||||
|
|
||||||
assert(move_is_ok(move));
|
assert(move_is_ok(move));
|
||||||
|
|
Loading…
Add table
Reference in a new issue