newDepth = (Iteration - 2) * OnePly + ext + InitialDepth;
// Make the move, and search it
- pos.do_move(move, u, dcCandidates);
+ pos.do_move(move, u);
if (i < MultiPV)
{
Move move, movesSearched[256];
int moveCount = 0;
Value value, bestValue = -VALUE_INFINITE;
- Bitboard dcCandidates = mp.discovered_check_candidates();
+ Color us = pos.side_to_move();
+ Bitboard dcCandidates = pos.discovered_check_candidates(us);
bool isCheck = pos.is_check();
- bool mateThreat = pos.has_mate_threat(opposite_color(pos.side_to_move()));
+ bool mateThreat = pos.has_mate_threat(opposite_color(us));
// Loop through all legal moves until no moves remain or a beta cutoff
// occurs.
assert(move_is_ok(move));
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);
movesSearched[moveCount++] = ss[ply].currentMove = move;
// Make and search the move
UndoInfo u;
- pos.do_move(move, u, dcCandidates);
+ pos.do_move(move, u);
if (moveCount == 1) // The first move in list is the PV
value = -search_pv(pos, ss, -beta, -alpha, newDepth, ply+1, threadID);
Move move, movesSearched[256];
int moveCount = 0;
Value value, bestValue = -VALUE_INFINITE;
- Bitboard dcCandidates = mp.discovered_check_candidates();
+ Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
Value futilityValue = VALUE_NONE;
bool useFutilityPruning = UseFutilityPruning
&& depth < SelectiveDepth
assert(move_is_ok(move));
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);
movesSearched[moveCount++] = ss[ply].currentMove = move;
// Make and search the move
UndoInfo u;
- pos.do_move(move, u, dcCandidates);
+ pos.do_move(move, u);
// Try to reduce non-pv search depth by one ply if move seems not problematic,
// if the move fails high will be re-searched at full depth.
MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, isCheck ? NULL : &ei);
Move move;
int moveCount = 0;
- Bitboard dcCandidates = mp.discovered_check_candidates();
- bool enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
+ Color us = pos.side_to_move();
+ Bitboard dcCandidates = pos.discovered_check_candidates(us);
+ bool enoughMaterial = pos.non_pawn_material(us) > RookValueMidgame;
// Loop through the moves until no moves remain or a beta cutoff
// occurs.
&& !isCheck
&& !pvNode
&& !move_promotion(move)
- && !pos.move_is_check(move, dcCandidates)
+ && !pos.move_is_check(move)
&& !pos.move_is_passed_pawn_push(move))
{
Value futilityValue = staticValue
// Make and search the move.
UndoInfo u;
- pos.do_move(move, u, dcCandidates);
+ pos.do_move(move, u);
Value value = -qsearch(pos, ss, -beta, -alpha, depth-OnePly, ply+1, threadID);
pos.undo_move(move, u);
&& (move = sp->mp->get_next_move(sp->lock)) != MOVE_NONE)
{
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);
lock_grab(&(sp->lock));
// Make and search the move.
UndoInfo u;
- pos.do_move(move, u, sp->dcCandidates);
+ pos.do_move(move, u);
// Try to reduce non-pv search depth by one ply if move seems not problematic,
// if the move fails high will be re-searched at full depth.
&& !thread_should_stop(threadID)
&& (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);
assert(move_is_ok(move));
// Make and search the move.
UndoInfo u;
- pos.do_move(move, u, sp->dcCandidates);
+ pos.do_move(move, u);
// Try to reduce non-pv search depth by one ply if move seems not problematic,
// if the move fails high will be re-searched at full depth.
// Case 4: The destination square for m2 is attacked by the moving piece
// in m1:
- if(pos.piece_attacks_square(t1, t2))
+ if(pos.piece_attacks_square(pos.piece_on(t1), t1, t2))
return true;
// Case 5: Discovered check, checking piece is the piece moved in m1: