Skip to content

Commit

Permalink
Cfish 11a
Browse files Browse the repository at this point in the history
This fixes a minor problem causing diverging node counts and re-enables large pages on Linux. It also fixes the one-by-off error in reported seldepth.
  • Loading branch information
syzygy1 committed Jul 11, 2020
1 parent 855bee2 commit 2201fb4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

// Version number. If Version is left empty, then compile date in the format
// DD-MM-YY and show in engine_info.
char Version[] = "11";
char Version[] = "11a";

#ifndef _WIN32
pthread_mutex_t ioMutex = PTHREAD_MUTEX_INITIALIZER;
Expand Down
16 changes: 7 additions & 9 deletions src/ntsearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Value search_NonPV(Pos *pos, Stack *ss, Value alpha, Depth depth, int cutNode)
&& ss->staticEval >= beta - 32 * depth + 292 - improving * 30
&& !excludedMove
&& non_pawn_material_c(stm())
&& (ss->ply >= pos->nmpPly || ss->ply % 2 != pos->nmpOdd))
&& (ss->ply >= pos->nmpMinPly || stm() != pos->nmpColor))
{
assert(eval - beta >= 0);

Expand All @@ -301,19 +301,17 @@ Value search_NonPV(Pos *pos, Stack *ss, Value alpha, Depth depth, int cutNode)
if (nullValue >= VALUE_MATE_IN_MAX_PLY)
nullValue = beta;

if ( (depth < 13 || pos->nmpPly)
&& abs(beta) < VALUE_KNOWN_WIN)
if (pos->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 13))
return nullValue;

// Do verification search at high depths
// Disable null move pruning for side to move for the first part of
// the remaining search tree
pos->nmpPly = ss->ply + 3 * (depth-R) / 4;
pos->nmpOdd = ss->ply & 1;
// Do verification search at high depths, with null move pruning
// disabled for us, until ply exceeds nmpMinPly
pos->nmpMinPly = ss->ply + 3 * (depth-R) / 4;
pos->nmpColor = stm();

Value v = search_NonPV(pos, ss, beta-1, depth-R, 0);

pos->nmpOdd = pos->nmpPly = 0;
pos->nmpMinPly = 0;

if (v >= beta)
return nullValue;
Expand Down
3 changes: 2 additions & 1 deletion src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ struct Pos {
uint64_t tbHits;
uint64_t ttHitAverage;
int pvIdx, pvLast;
int selDepth, nmpPly, nmpOdd;
int selDepth, nmpMinPly;
uint32_t nmpColor;
Depth rootDepth;
Depth completedDepth;
Score contempt;
Expand Down
4 changes: 2 additions & 2 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ static void uci_print_pv(Pos *pos, Depth depth, Value alpha, Value beta)
TB_expand_mate(pos, &rm->move[i]);

printf("info depth %d seldepth %d multipv %d score %s",
d, rm->move[i].selDepth, i + 1,
d, rm->move[i].selDepth + 1, i + 1,
uci_value(buf, v));

if (!tb && i == pvIdx)
Expand Down Expand Up @@ -1010,7 +1010,7 @@ void start_thinking(Pos *root)
for (int idx = 0; idx < Threads.numThreads; idx++) {
Pos *pos = Threads.pos[idx];
pos->selDepth = 0;
pos->nmpPly = pos->nmpOdd = 0;
pos->nmpMinPly = 0;
pos->rootDepth = 0;
pos->nodes = pos->tbHits = 0;
RootMoves *rm = pos->rootMoves;
Expand Down
2 changes: 2 additions & 0 deletions src/ucioption.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#define _GNU_SOURCE

#include <assert.h>
#include <ctype.h>
#include <stdio.h>
Expand Down

0 comments on commit 2201fb4

Please sign in to comment.