Skip to content
Permalink
Browse files

Merge pull request #12 from official-stockfish/master

Update to master
  • Loading branch information...
Chess13234 committed Jan 10, 2019
2 parents 4c11d17 + 5446e6f commit 31e04f2ad0a48469f7ad20a07af201d8a759703a
Showing with 10 additions and 15 deletions.
  1. +6 −11 src/search.cpp
  2. +4 −4 src/tt.cpp
@@ -578,7 +578,7 @@ namespace {
Depth extension, newDepth;
Value bestValue, value, ttValue, eval, maxValue, pureStaticEval;
bool ttHit, pvHit, inCheck, givesCheck, improving;
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact;
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture;
Piece movedPiece;
int moveCount, captureCount, quietCount;

@@ -643,7 +643,7 @@ namespace {
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
ttMove = rootNode ? thisThread->rootMoves[thisThread->pvIdx].pv[0]
: ttHit ? tte->move() : MOVE_NONE;
pvHit = ttHit ? tte->pv_hit() : false;
pvHit = ttHit && tte->pv_hit();

// At non-PV nodes we check for an early TT cutoff
if ( !PvNode
@@ -677,7 +677,7 @@ namespace {
return ttValue;
}

if ( depth > 6 * ONE_PLY
if ( depth > 4 * ONE_PLY
&& !excludedMove
&& PvNode)
pvHit = true;
@@ -881,7 +881,7 @@ namespace {
tte = TT.probe(posKey, ttHit);
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
ttMove = ttHit ? tte->move() : MOVE_NONE;
pvHit = ttHit ? tte->pv_hit() : false;
pvHit = ttHit && tte->pv_hit();
}

moves_loop: // When in check, search starts from here
@@ -898,7 +898,6 @@ namespace {

skipQuiets = false;
ttCapture = ttMove && pos.capture_or_promotion(ttMove);
pvExact = PvNode && ttHit && tte->bound() == BOUND_EXACT;

// Step 12. Loop through all pseudo-legal moves until no moves remain
// or a beta cutoff occurs.
@@ -1043,7 +1042,7 @@ namespace {
Depth r = reduction<PvNode>(improving, depth, moveCount);

// Decrease reduction if position is or has been on the PV
if (pvHit && !PvNode)
if (pvHit)
r -= ONE_PLY;

// Decrease reduction if opponent's move count is high (~10 Elo)
@@ -1052,10 +1051,6 @@ namespace {

if (!captureOrPromotion)
{
// Decrease reduction for exact PV nodes (~0 Elo)
if (pvExact)
r -= ONE_PLY;

// Increase reduction if ttMove is a capture (~0 Elo)
if (ttCapture)
r += ONE_PLY;
@@ -1292,7 +1287,7 @@ namespace {
tte = TT.probe(posKey, ttHit);
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
ttMove = ttHit ? tte->move() : MOVE_NONE;
pvHit = ttHit ? tte->pv_hit() : false;
pvHit = ttHit && tte->pv_hit();

if ( !PvNode
&& ttHit
@@ -122,7 +122,7 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
for (int i = 0; i < ClusterSize; ++i)
if (!tte[i].key16 || tte[i].key16 == key16)
{
tte[i].genBound8 = uint8_t(generation8 | tte[i].pv_hit() << 2 | tte[i].bound()); // Refresh
tte[i].genBound8 = uint8_t(generation8 | (tte[i].genBound8 & 0x7)); // Refresh

return found = (bool)tte[i].key16, &tte[i];
}
@@ -131,8 +131,8 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
TTEntry* replace = tte;
for (int i = 1; i < ClusterSize; ++i)
// Due to our packed storage format for generation and its cyclic
// nature we add 263 (263 is the modulus plus 7 to keep the lowest
// two bound bits from affecting the result) to calculate the entry
// nature we add 263 (256 is the modulus plus 7 to keep the unrelated
// lowest three bits from affecting the result) to calculate the entry
// age correctly even after generation8 overflows into the next cycle.
if ( replace->depth8 - ((263 + generation8 - replace->genBound8) & 0xF8)
> tte[i].depth8 - ((263 + generation8 - tte[i].genBound8) & 0xF8))
@@ -150,7 +150,7 @@ int TranspositionTable::hashfull() const {
int cnt = 0;
for (int i = 0; i < 1000 / ClusterSize; ++i)
for (int j = 0; j < ClusterSize; ++j)
cnt += (table[i].entry[j].genBound8 & 0xFC) == generation8;
cnt += (table[i].entry[j].genBound8 & 0xF8) == generation8;

return cnt * 1000 / (ClusterSize * (1000 / ClusterSize));
}

0 comments on commit 31e04f2

Please sign in to comment.
You can’t perform that action at this time.