From: Fabian Fichter Date: Sat, 9 Feb 2019 17:13:35 +0000 (+0100) Subject: Merge official-stockfish/master X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=8feea1b3ea34ef28f869884bd42e3c4b25a62cf6;p=fairystockfish.git Merge official-stockfish/master bench: 4633927 --- 8feea1b3ea34ef28f869884bd42e3c4b25a62cf6 diff --cc src/evaluate.cpp index cf119e1,ef69ee6..31c966b --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@@ -664,13 -551,13 +661,13 @@@ namespace { Square s = pop_lsb(&b); score += ThreatByRook[type_of(pos.piece_on(s))]; - if (type_of(pos.piece_on(s)) != PAWN) - score += ThreatByRank * (int)relative_rank(Them, s); + if (type_of(pos.piece_on(s)) != PAWN && type_of(pos.piece_on(s)) != SHOGI_PAWN) + score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank()); } - b = weak & attackedBy[Us][KING]; - if (b) - score += ThreatByKing[more_than_one(b)]; + // Bonus for king attacks on pawns or pieces which are not pawn-defended + if (weak & attackedBy[Us][KING]) + score += ThreatByKing; score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]); diff --cc src/search.cpp index 97517c4,7cb53fb..2f4fdec --- a/src/search.cpp +++ b/src/search.cpp @@@ -713,10 -708,10 +713,10 @@@ namespace { ss->staticEval = eval = (ss-1)->currentMove != MOVE_NULL ? evaluate(pos) - : -(ss-1)->staticEval + 2 * Eval::Tempo; + : -(ss-1)->staticEval + 2 * Eval::tempo_value(pos); tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, - ss->staticEval, TT.generation()); + ss->staticEval); } // Step 7. Razoring (~2 Elo) diff --cc src/tt.cpp index 9f0bc4b,2679180..49854e2 --- a/src/tt.cpp +++ b/src/tt.cpp @@@ -29,6 -29,28 +29,28 @@@ TranspositionTable TT; // Our global transposition table + /// TTEntry::save saves a TTEntry + void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) { + + assert(d / ONE_PLY * ONE_PLY == d); + + // Preserve any existing move for the same position + if (m || (k >> 48) != key16) - move16 = (uint16_t)m; ++ move32 = (uint32_t)m; + + // Overwrite less valuable entries + if ( (k >> 48) != key16 + || d / ONE_PLY > depth8 - 4 + || b == BOUND_EXACT) + { + key16 = (uint16_t)(k >> 48); + value16 = (int16_t)v; + eval16 = (int16_t)ev; + genBound8 = (uint8_t)(TT.generation8 | b); + depth8 = (int8_t)(d / ONE_PLY); + } + } + /// TranspositionTable::resize() sets the size of the transposition table, /// measured in megabytes. Transposition table consists of a power of 2 number