<< " hashfull " << TT.full() << std::endl;
// Print the best move and the ponder move to the standard output
+ if (ss[0].pv[0] == MOVE_NONE)
+ {
+ ss[0].pv[0] = rml.get_move(0);
+ ss[0].pv[1] = MOVE_NONE;
+ }
std::cout << "bestmove " << ss[0].pv[0];
if (ss[0].pv[1] != MOVE_NONE)
std::cout << " ponder " << ss[0].pv[1];
{
Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
if ( (v < beta - RazorMargin - RazorMargin / 4)
- || (depth < 3*OnePly && v < beta - RazorMargin)
- || (depth < 2*OnePly && v < beta - RazorMargin / 2))
+ || (depth <= 2*OnePly && v < beta - RazorMargin)
+ || (depth <= OnePly && v < beta - RazorMargin / 2))
return v;
}
&& !move_is_castle(move)
&& !move_is_killer(move, ss[ply]))
{
- ss[ply].reduction = OnePly;
- value = -search(pos, ss, -(beta-1), newDepth-OnePly, ply+1, true, threadID);
+ // LMR dynamic reduction
+ Depth R = (moveCount >= 2 * LMRNonPVMoves && depth > 7*OnePly ? 2*OnePly : OnePly);
+
+ ss[ply].reduction = R;
+ value = -search(pos, ss, -(beta-1), newDepth-R, ply+1, true, threadID);
}
else
value = beta; // Just to trigger next condition
}
TT.store(pos, value_to_tt(bestValue, ply), depth, m, VALUE_TYPE_LOWER);
}
+
+ assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
+
return bestValue;
}
if (pos.is_draw())
return VALUE_DRAW;
- // Transposition table lookup
- const TTEntry* tte = TT.retrieve(pos);
- if (tte && ok_to_use_TT(tte, depth, beta, ply))
- return value_from_tt(tte->value(), ply);
+ // Transposition table lookup, only when not in PV
+ bool pvNode = (beta - alpha != 1);
+ if (!pvNode)
+ {
+ const TTEntry* tte = TT.retrieve(pos);
+ if (tte && ok_to_use_TT(tte, depth, beta, ply))
+ return value_from_tt(tte->value(), ply);
+ }
// Evaluate the position statically
EvalInfo ei;
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
// queen promotions and checks (only if depth == 0) will be generated.
- bool pvNode = (beta - alpha != 1);
MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, isCheck ? NULL : &ei);
Move move;
int moveCount = 0;
|| ( !FailHigh && !fail_high_ply_1() && !Problem
&& t > 6*(MaxSearchTime + ExtraSearchTime));
- if ( (Iteration >= 2 && (!InfiniteSearch && overTime))
+ if ( (Iteration >= 3 && (!InfiniteSearch && overTime))
|| (ExactMaxTime && t >= ExactMaxTime)
|| (Iteration >= 3 && MaxNodes && nodes_searched() >= MaxNodes))
AbortSearch = true;
void ponderhit() {
int t = current_search_time();
PonderSearch = false;
- if(Iteration >= 2 &&
+ if(Iteration >= 3 &&
(!InfiniteSearch && (StopOnPonderhit ||
t > AbsoluteMaxSearchTime ||
(RootMoveNumber == 1 &&