]> git.sesse.net Git - stockfish/commitdiff
Merge increased 'movecount' pruning
authorMarco Costalba <mcostalba@gmail.com>
Sun, 5 May 2013 11:43:26 +0000 (13:43 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 5 May 2013 11:46:26 +0000 (13:46 +0200)
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

src/evaluate.cpp
src/misc.cpp
src/pawns.h
src/platform.h
src/search.cpp

index e861f5f032e95d80f54bb4137447e617686b338b..fe4eef57493c8ed3a601120dc7fee3233e7a1b5d 100644 (file)
@@ -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<KNIGHT, Us, Trace>(pos, ei, mobility, mobilityArea);
     score += evaluate_pieces<BISHOP, Us, Trace>(pos, ei, mobility, mobilityArea);
index 477fb392c6add636f01a46c7e0bf1b7ca51113c4..cad8e39d08d4ba6ba66f91c8cfc857d2eae3d219 100644 (file)
@@ -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;
index 293869bc777c6ed39c4d42d7f78858c18345de44..39fc9e3f16aa94c0acdebe3191448ca32178c0b4 100644 (file)
@@ -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<Color Us>
   Score king_safety(const Position& pos, Square ksq)  {
index ad02575bc4b983d207543252049759816e39f21f..334a0eecd0a1a914c22460eb5086af000e9b1753 100644 (file)
@@ -43,7 +43,7 @@ typedef unsigned __int64 uint64_t;
 #  include <unistd.h>  // Used by sysconf(_SC_NPROCESSORS_ONLN)
 #endif
 
-#if !defined(_WIN32) && !defined(_WIN64) // Linux - Unix
+#if !defined(_WIN32) // Linux - Unix
 
 #  include <sys/time.h>
 typedef timeval sys_time_t;
index 426852416e0e629fad606bfa0c15d4778f4c9bc4..daed19135359406ddfde08e3c5f825b5e918803c 100644 (file)
@@ -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"