mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Call poll() before to check for stopped search
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
96d0501735
commit
2d0146fe1d
1 changed files with 23 additions and 19 deletions
|
@ -940,16 +940,17 @@ namespace {
|
||||||
assert(ply >= 0 && ply < PLY_MAX);
|
assert(ply >= 0 && ply < PLY_MAX);
|
||||||
assert(threadID >= 0 && threadID < ActiveThreads);
|
assert(threadID >= 0 && threadID < ActiveThreads);
|
||||||
|
|
||||||
// Initialize, and make an early exit in case of an aborted search,
|
|
||||||
// an instant draw, maximum ply reached, etc.
|
|
||||||
if (AbortSearch || thread_should_stop(threadID))
|
|
||||||
return Value(0);
|
|
||||||
|
|
||||||
if (depth < OnePly)
|
if (depth < OnePly)
|
||||||
return qsearch(pos, ss, alpha, beta, Depth(0), ply, threadID);
|
return qsearch(pos, ss, alpha, beta, Depth(0), ply, threadID);
|
||||||
|
|
||||||
|
// Initialize, and make an early exit in case of an aborted search,
|
||||||
|
// an instant draw, maximum ply reached, etc.
|
||||||
init_node(pos, ss, ply, threadID);
|
init_node(pos, ss, ply, threadID);
|
||||||
|
|
||||||
|
// After init_node() that calls poll()
|
||||||
|
if (AbortSearch || thread_should_stop(threadID))
|
||||||
|
return Value(0);
|
||||||
|
|
||||||
if (pos.is_draw())
|
if (pos.is_draw())
|
||||||
return VALUE_DRAW;
|
return VALUE_DRAW;
|
||||||
|
|
||||||
|
@ -1132,21 +1133,22 @@ namespace {
|
||||||
assert(ply >= 0 && ply < PLY_MAX);
|
assert(ply >= 0 && ply < PLY_MAX);
|
||||||
assert(threadID >= 0 && threadID < ActiveThreads);
|
assert(threadID >= 0 && threadID < ActiveThreads);
|
||||||
|
|
||||||
EvalInfo ei;
|
|
||||||
|
|
||||||
// Initialize, and make an early exit in case of an aborted search,
|
|
||||||
// an instant draw, maximum ply reached, etc.
|
|
||||||
if (AbortSearch || thread_should_stop(threadID))
|
|
||||||
return Value(0);
|
|
||||||
|
|
||||||
if (depth < OnePly)
|
if (depth < OnePly)
|
||||||
return qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
|
return qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
|
||||||
|
|
||||||
|
// Initialize, and make an early exit in case of an aborted search,
|
||||||
|
// an instant draw, maximum ply reached, etc.
|
||||||
init_node(pos, ss, ply, threadID);
|
init_node(pos, ss, ply, threadID);
|
||||||
|
|
||||||
|
// After init_node() that calls poll()
|
||||||
|
if (AbortSearch || thread_should_stop(threadID))
|
||||||
|
return Value(0);
|
||||||
|
|
||||||
if (pos.is_draw())
|
if (pos.is_draw())
|
||||||
return VALUE_DRAW;
|
return VALUE_DRAW;
|
||||||
|
|
||||||
|
EvalInfo ei;
|
||||||
|
|
||||||
if (ply >= PLY_MAX - 1)
|
if (ply >= PLY_MAX - 1)
|
||||||
return evaluate(pos, ei, threadID);
|
return evaluate(pos, ei, threadID);
|
||||||
|
|
||||||
|
@ -1189,8 +1191,8 @@ namespace {
|
||||||
Value nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID);
|
Value nullValue = -search(pos, ss, -(beta-1), depth-R*OnePly, ply+1, false, threadID);
|
||||||
|
|
||||||
// Check for a null capture artifact, if the value without the null capture
|
// Check for a null capture artifact, if the value without the null capture
|
||||||
// is above beta then there is a good possibility that this is a cut-node.
|
// is above beta then mark the node as a suspicious failed low. We will verify
|
||||||
// We will do an IID later to find a ttMove.
|
// later if we are really under threat.
|
||||||
if ( UseNullDrivenIID
|
if ( UseNullDrivenIID
|
||||||
&& nullValue < beta
|
&& nullValue < beta
|
||||||
&& depth > 6 * OnePly
|
&& depth > 6 * OnePly
|
||||||
|
@ -1256,7 +1258,9 @@ namespace {
|
||||||
{
|
{
|
||||||
// The null move failed low due to a suspicious capture. Perhaps we
|
// The null move failed low due to a suspicious capture. Perhaps we
|
||||||
// are facing a null capture artifact due to the side to move change
|
// are facing a null capture artifact due to the side to move change
|
||||||
// and this is a cut-node. So it's a good time to search for a ttMove.
|
// and this position should fail high. So do a normal search with a
|
||||||
|
// reduced depth to get a good ttMove to use in the following full
|
||||||
|
// depth search.
|
||||||
Move tm = ss[ply].threatMove;
|
Move tm = ss[ply].threatMove;
|
||||||
|
|
||||||
assert(tm != MOVE_NONE);
|
assert(tm != MOVE_NONE);
|
||||||
|
@ -1419,15 +1423,14 @@ namespace {
|
||||||
assert(ply >= 0 && ply < PLY_MAX);
|
assert(ply >= 0 && ply < PLY_MAX);
|
||||||
assert(threadID >= 0 && threadID < ActiveThreads);
|
assert(threadID >= 0 && threadID < ActiveThreads);
|
||||||
|
|
||||||
EvalInfo ei;
|
|
||||||
|
|
||||||
// Initialize, and make an early exit in case of an aborted search,
|
// Initialize, and make an early exit in case of an aborted search,
|
||||||
// an instant draw, maximum ply reached, etc.
|
// an instant draw, maximum ply reached, etc.
|
||||||
|
init_node(pos, ss, ply, threadID);
|
||||||
|
|
||||||
|
// After init_node() that calls poll()
|
||||||
if (AbortSearch || thread_should_stop(threadID))
|
if (AbortSearch || thread_should_stop(threadID))
|
||||||
return Value(0);
|
return Value(0);
|
||||||
|
|
||||||
init_node(pos, ss, ply, threadID);
|
|
||||||
|
|
||||||
if (pos.is_draw())
|
if (pos.is_draw())
|
||||||
return VALUE_DRAW;
|
return VALUE_DRAW;
|
||||||
|
|
||||||
|
@ -1437,6 +1440,7 @@ namespace {
|
||||||
return value_from_tt(tte->value(), ply);
|
return value_from_tt(tte->value(), ply);
|
||||||
|
|
||||||
// Evaluate the position statically
|
// Evaluate the position statically
|
||||||
|
EvalInfo ei;
|
||||||
bool isCheck = pos.is_check();
|
bool isCheck = pos.is_check();
|
||||||
Value staticValue = (isCheck ? -VALUE_INFINITE : evaluate(pos, ei, threadID));
|
Value staticValue = (isCheck ? -VALUE_INFINITE : evaluate(pos, ei, threadID));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue