From: Marco Costalba Date: Sun, 5 May 2013 11:43:26 +0000 (+0200) Subject: Merge increased 'movecount' pruning X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=7f4c7cd785fed40b4c778c1b21f1cc99621bab32;hp=11d30b629814a2de446bb1e92b58276556cef29e Merge increased 'movecount' pruning Good at both short and long TC 15+0.05 LLR: 2.95 (-2.94,2.94) Total: 13814 W: 2731 L: 2588 D: 8495 TC 60+0.05 LLR: 2.95 (-2.94,2.94) Total: 18013 W: 3136 L: 2946 D: 11931 bench: 4306557 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index e861f5f0..fe4eef57 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -642,31 +642,19 @@ Value do_evaluate(const Position& pos, Value& margin) { score += RookHalfOpenFileBonus; } - // Penalize rooks which are trapped inside a king. Penalize more if - // king has lost right to castle. if (mob > 6 || ei.pi->file_is_half_open(Us, f)) continue; ksq = pos.king_square(Us); - if ( file_of(ksq) >= FILE_E - && file_of(s) > file_of(ksq) - && (relative_rank(Us, ksq) == RANK_1 || rank_of(ksq) == rank_of(s))) - { - // Is there a half-open file between the king and the edge of the board? - if (!ei.pi->has_open_file_to_right(Us, file_of(ksq))) - score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2 - : (TrappedRookPenalty - mob * 16), 0); - } - else if ( file_of(ksq) <= FILE_D - && file_of(s) < file_of(ksq) - && (relative_rank(Us, ksq) == RANK_1 || rank_of(ksq) == rank_of(s))) - { - // Is there a half-open file between the king and the edge of the board? - if (!ei.pi->has_open_file_to_left(Us, file_of(ksq))) - score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2 - : (TrappedRookPenalty - mob * 16), 0); - } + // Penalize rooks which are trapped inside a king. Penalize more if + // king has lost right to castle. + if ( ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq))) + && rank_of(ksq) == rank_of(s) + && relative_rank(Us, ksq) == RANK_1 + && !ei.pi->has_open_file_on_side(Us, file_of(ksq), file_of(ksq) < FILE_E)) + score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2 + : (TrappedRookPenalty - mob * 16), 0); } } @@ -730,7 +718,7 @@ Value do_evaluate(const Position& pos, Value& margin) { Score score = mobility = SCORE_ZERO; // Do not include in mobility squares protected by enemy pawns or occupied by our pieces - const Bitboard mobilityArea = ~(ei.attackedBy[Them][PAWN] | pos.pieces(Us)); + const Bitboard mobilityArea = ~(ei.attackedBy[Them][PAWN] | pos.pieces(Us, PAWN, KING)); score += evaluate_pieces(pos, ei, mobility, mobilityArea); score += evaluate_pieces(pos, ei, mobility, mobilityArea); diff --git a/src/misc.cpp b/src/misc.cpp index 477fb392..cad8e39d 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -178,7 +178,7 @@ void start_logger(bool b) { Logger::start(b); } int cpu_count() { -#if defined(_WIN32) || defined(_WIN64) +#if defined(_WIN32) SYSTEM_INFO s; GetSystemInfo(&s); return s.dwNumberOfProcessors; @@ -204,7 +204,7 @@ int cpu_count() { void timed_wait(WaitCondition& sleepCond, Lock& sleepLock, int msec) { -#if defined(_WIN32) || defined(_WIN64) +#if defined(_WIN32) int tm = msec; #else timespec ts, *tm = &ts; diff --git a/src/pawns.h b/src/pawns.h index 293869bc..39fc9e3f 100644 --- a/src/pawns.h +++ b/src/pawns.h @@ -38,9 +38,10 @@ struct Entry { Bitboard pawn_attacks(Color c) const { return pawnAttacks[c]; } Bitboard passed_pawns(Color c) const { return passedPawns[c]; } int file_is_half_open(Color c, File f) const { return halfOpenFiles[c] & (1 << int(f)); } - int has_open_file_to_left(Color c, File f) const { return halfOpenFiles[c] & ((1 << int(f)) - 1); } - int has_open_file_to_right(Color c, File f) const { return halfOpenFiles[c] & ~((1 << int(f+1)) - 1); } int pawns_on_same_color_squares(Color c, Square s) const { return pawnsOnSquares[c][!!(BlackSquares & s)]; } + int has_open_file_on_side(Color c, File f, bool left) const { + return halfOpenFiles[c] & (left ? ((1 << int(f)) - 1) : ~((1 << int(f+1)) - 1)); + } template Score king_safety(const Position& pos, Square ksq) { diff --git a/src/platform.h b/src/platform.h index ad02575b..334a0eec 100644 --- a/src/platform.h +++ b/src/platform.h @@ -43,7 +43,7 @@ typedef unsigned __int64 uint64_t; # include // Used by sysconf(_SC_NPROCESSORS_ONLN) #endif -#if !defined(_WIN32) && !defined(_WIN64) // Linux - Unix +#if !defined(_WIN32) // Linux - Unix # include typedef timeval sys_time_t; diff --git a/src/search.cpp b/src/search.cpp index 42685241..daed1913 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -264,6 +264,10 @@ void Search::think() { finalize: + // When search is stopped this info is not printed + sync_cout << "info nodes " << RootPos.nodes_searched() + << " time " << Time::now() - SearchTime + 1 << sync_endl; + // When we reach max depth we arrive here even without Signals.stop is raised, // but if we are pondering or in infinite search, according to UCI protocol, // we shouldn't print the best move before the GUI sends a "stop" or "ponderhit"