- value = sp->alpha + 1;
- if(value > sp->alpha) {
- ss[sp->ply].reduction = Depth(0);
- value = -search(pos, ss, -sp->alpha, newDepth, sp->ply+1, true,
- threadID);
- if(value > sp->alpha && value < sp->beta) {
- if(sp->ply == 1 && RootMoveNumber == 1)
- // When the search fails high at ply 1 while searching the first
- // move at the root, set the flag failHighPly1. This is used for
- // time managment: We don't want to stop the search early in
- // such cases, because resolving the fail high at ply 1 could
- // result in a big drop in score at the root.
- Threads[threadID].failHighPly1 = true;
- value = -search_pv(pos, ss, -sp->beta, -sp->alpha, newDepth,
- sp->ply+1, threadID);
- Threads[threadID].failHighPly1 = false;
+ value = sp->alpha + 1; // Just to trigger next condition
+
+ if (value > sp->alpha) // Go with full depth non-pv search
+ {
+ ss[sp->ply].reduction = Depth(0);
+ value = -search(pos, ss, -sp->alpha, newDepth, sp->ply+1, true, threadID);
+
+ if (value > sp->alpha && value < sp->beta)
+ {
+ // When the search fails high at ply 1 while searching the first
+ // move at the root, set the flag failHighPly1. This is used for
+ // time managment: We don't want to stop the search early in
+ // such cases, because resolving the fail high at ply 1 could
+ // result in a big drop in score at the root.
+ if (sp->ply == 1 && RootMoveNumber == 1)
+ Threads[threadID].failHighPly1 = true;
+
+ value = -search_pv(pos, ss, -sp->beta, -sp->alpha, newDepth, sp->ply+1, threadID);
+ Threads[threadID].failHighPly1 = false;