Skip to content

Commit c4f0cc4

Browse files
authored
Merge pull request official-stockfish#651 from IIvec/master
New master
2 parents 8bf14b8 + d71adc5 commit c4f0cc4

File tree

2 files changed

+7
-29
lines changed

2 files changed

+7
-29
lines changed

src/evaluate.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,10 @@ std::string Eval::trace(const Position& pos) {
919919

920920
std::memset(scores, 0, sizeof(scores));
921921

922-
Value v = Evaluation<TRACE>(pos).value() + Eval::Tempo;
922+
Eval::Contempt = SCORE_ZERO;
923+
924+
Value v = Eval::Tempo + Evaluation<TRACE>(pos).value();
925+
923926
v = pos.side_to_move() == WHITE ? v : -v; // White's point of view
924927

925928
std::stringstream ss;

src/search.cpp

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ namespace {
107107
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus);
108108
void update_stats(const Position& pos, Stack* ss, Move move, Move* quiets, int quietsCnt, int bonus);
109109
void update_capture_stats(const Position& pos, Move move, Move* captures, int captureCnt, int bonus);
110-
bool pv_is_draw(Position& pos);
111110

112111
// perft() is our utility to verify move generation. All the leaf nodes up
113112
// to the given depth are generated and counted, and the sum is returned.
@@ -438,24 +437,19 @@ void Thread::search() {
438437
bestValue - mainThread->previousScore };
439438
int improvingFactor = std::max(229, std::min(715, 357 + 119 * F[0] - 6 * F[1]));
440439

441-
Color us = rootPos.side_to_move();
442-
bool thinkHard = bestValue == VALUE_DRAW
443-
&& Limits.time[us] - Time.elapsed() > Limits.time[~us]
444-
&& ::pv_is_draw(rootPos);
445-
446-
double unstablePvFactor = 1 + mainThread->bestMoveChanges + thinkHard;
440+
double unstablePvFactor = 1 + mainThread->bestMoveChanges;
447441

448442
// if the bestMove is stable over several iterations, reduce time for this move,
449443
// the longer the move has been stable, the more.
450444
// Use part of the gained time from a previous stable move for the current move.
451445
timeReduction = 1;
452446
for (int i : {3, 4, 5})
453-
if (lastBestMoveDepth * i < completedDepth && !thinkHard)
447+
if (lastBestMoveDepth * i < completedDepth )
454448
timeReduction *= 1.3;
455449
unstablePvFactor *= std::pow(mainThread->previousTimeReduction, 0.51) / timeReduction;
456450

457451
if ( rootMoves.size() == 1
458-
|| Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 628)
452+
|| Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 605)
459453
{
460454
// If we are allowed to ponder do not stop the search now but
461455
// keep pondering until the GUI sends "ponderhit" or "stop".
@@ -1433,25 +1427,6 @@ namespace {
14331427
}
14341428
}
14351429

1436-
1437-
// Is the PV leading to a draw position? Assumes all pv moves are legal
1438-
bool pv_is_draw(Position& pos) {
1439-
1440-
StateInfo st[MAX_PLY];
1441-
auto& pv = pos.this_thread()->rootMoves[0].pv;
1442-
1443-
for (size_t i = 0; i < pv.size(); ++i)
1444-
pos.do_move(pv[i], st[i]);
1445-
1446-
bool isDraw = pos.is_draw(pv.size());
1447-
1448-
for (size_t i = pv.size(); i > 0; --i)
1449-
pos.undo_move(pv[i-1]);
1450-
1451-
return isDraw;
1452-
}
1453-
1454-
14551430
// When playing with strength handicap, choose best move among a set of RootMoves
14561431
// using a statistical rule dependent on 'level'. Idea by Heinz van Saanen.
14571432

0 commit comments

Comments
 (0)