]> git.sesse.net Git - stockfish/commitdiff
Merge pull request #89 from official-stockfish/pull_no_pretty
authorMarco Costalba <mcostalba@gmail.com>
Sat, 1 Nov 2014 21:24:33 +0000 (22:24 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 1 Nov 2014 21:24:33 +0000 (22:24 +0100)
Prefer operator<<() to pretty()

No functional change.

src/benchmark.cpp
src/evaluate.cpp
src/misc.cpp
src/movepick.cpp
src/pawns.cpp
src/position.cpp
src/ucioption.cpp

index c861c8f3947ac90e99b420477b7a066720e625d8..1d97c95b7109a720a8b1302ad95f1a43e387c5d5 100644 (file)
@@ -32,7 +32,9 @@
 
 using namespace std;
 
-static const char* Defaults[] = {
+namespace {
+
+const char* Defaults[] = {
   "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
   "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 10",
   "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 11",
@@ -65,6 +67,7 @@ static const char* Defaults[] = {
   "8/3p3B/5p2/5P2/p7/PP5b/k7/6K1 w - - 0 1"
 };
 
+} // namespace
 
 /// benchmark() runs a simple benchmark by letting Stockfish analyze a set
 /// of positions for a given limit each. There are five parameters: the
index f70014e293d2ac9d88d5e3fe9d62f8102ea70e2c..057fd70c8216ec5fd4cae5d212b76d760a5ca0fc 100644 (file)
@@ -27,7 +27,6 @@
 #include "material.h"
 #include "pawns.h"
 #include "thread.h"
-#include "uci.h"
 
 namespace {
 
@@ -903,8 +902,7 @@ namespace Eval {
   }
 
 
-  /// init() computes evaluation weights from the corresponding UCI parameters
-  /// and setup king tables.
+  /// init() computes evaluation weights.
 
   void init() {
 
index 4d0628227683e9822c9e7d03ccc8af7905e37d03..b3cd10a0e91e8f6987fb843d61057db6a13bd140 100644 (file)
 
 using namespace std;
 
+namespace {
+
 /// Version number. If Version is left empty, then compile date in the format
 /// DD-MM-YY and show in engine_info.
-static const string Version = "";
-
-
-/// engine_info() returns the full name of the current Stockfish version. This
-/// will be either "Stockfish <Tag> DD-MM-YY" (where DD-MM-YY is the date when
-/// the program was compiled) or "Stockfish <Version>", depending on whether
-/// Version is empty.
-
-const string engine_info(bool to_uci) {
-
-  const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
-  string month, day, year;
-  stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008"
-
-  ss << "Stockfish " << Version << setfill('0');
-
-  if (Version.empty())
-  {
-      date >> month >> day >> year;
-      ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2);
-  }
-
-  ss << (Is64Bit ? " 64" : "")
-     << (HasPext ? " BMI2" : (HasPopCnt ? " SSE4.2" : ""))
-     << (to_uci  ? "\nid author ": " by ")
-     << "Tord Romstad, Marco Costalba and Joona Kiiski";
-
-  return ss.str();
-}
-
-
-/// Debug functions used mainly to collect run-time statistics
-
-static int64_t hits[2], means[2];
-
-void dbg_hit_on(bool b) { ++hits[0]; if (b) ++hits[1]; }
-void dbg_hit_on_c(bool c, bool b) { if (c) dbg_hit_on(b); }
-void dbg_mean_of(int v) { ++means[0]; means[1] += v; }
-
-void dbg_print() {
-
-  if (hits[0])
-      cerr << "Total " << hits[0] << " Hits " << hits[1]
-           << " hit rate (%) " << 100 * hits[1] / hits[0] << endl;
-
-  if (means[0])
-      cerr << "Total " << means[0] << " Mean "
-           << (double)means[1] / means[0] << endl;
-}
+const string Version = "";
 
+/// Debug counters
+int64_t hits[2], means[2];
 
 /// Our fancy logging facility. The trick here is to replace cin.rdbuf() and
 /// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We
@@ -137,6 +93,53 @@ public:
   }
 };
 
+} // namespace
+
+/// engine_info() returns the full name of the current Stockfish version. This
+/// will be either "Stockfish <Tag> DD-MM-YY" (where DD-MM-YY is the date when
+/// the program was compiled) or "Stockfish <Version>", depending on whether
+/// Version is empty.
+
+const string engine_info(bool to_uci) {
+
+  const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
+  string month, day, year;
+  stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008"
+
+  ss << "Stockfish " << Version << setfill('0');
+
+  if (Version.empty())
+  {
+      date >> month >> day >> year;
+      ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2);
+  }
+
+  ss << (Is64Bit ? " 64" : "")
+     << (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : ""))
+     << (to_uci  ? "\nid author ": " by ")
+     << "Tord Romstad, Marco Costalba and Joona Kiiski";
+
+  return ss.str();
+}
+
+
+/// Debug functions used mainly to collect run-time statistics
+
+void dbg_hit_on(bool b) { ++hits[0]; if (b) ++hits[1]; }
+void dbg_hit_on_c(bool c, bool b) { if (c) dbg_hit_on(b); }
+void dbg_mean_of(int v) { ++means[0]; means[1] += v; }
+
+void dbg_print() {
+
+  if (hits[0])
+      cerr << "Total " << hits[0] << " Hits " << hits[1]
+           << " hit rate (%) " << 100 * hits[1] / hits[0] << endl;
+
+  if (means[0])
+      cerr << "Total " << means[0] << " Mean "
+           << (double)means[1] / means[0] << endl;
+}
+
 
 /// Used to serialize access to std::cout to avoid multiple threads writing at
 /// the same time.
index 95172b944c13705182f6c1a7842deece827448e5..84f26dbf7835c08a2794313aad91560d4e6f3991 100644 (file)
@@ -61,7 +61,7 @@ namespace {
       std::swap(*begin, *std::max_element(begin, end));
       return begin;
   }
-}
+} // namespace
 
 
 /// Constructors of the MovePicker class. As arguments we pass information
index 523ed15725001933556a20b195573ddcd5143e4e..3634f95746796afef7ab904856629b59d2c970fa 100644 (file)
@@ -57,9 +57,6 @@ namespace {
     S( 0, 0), S( 0, 0), S(0, 0), S(0, 0),
     S(20,20), S(40,40), S(0, 0), S(0, 0) };
 
-  // Bonus for file distance of the two outermost pawns
-  const Score PawnsFileSpan = S(0, 8);
-
   // Unsupported pawn penalty
   const Score UnsupportedPawnPenalty = S(20, 10);
 
@@ -183,10 +180,6 @@ namespace {
     b = e->semiopenFiles[Us] ^ 0xFF;
     e->pawnSpan[Us] = b ? int(msb(b) - lsb(b)) : 0;
 
-    // In endgame it's better to have pawns on both wings. So give a bonus according
-    // to file distance between left and right outermost pawns.
-    value += PawnsFileSpan * e->pawnSpan[Us];
-
     return value;
   }
 
index d43554d18e20fd9ff14a52014ee2a5dbcf086dd6..13fcdf247d65ba6d62570d05c3f72b368ff1bb57 100644 (file)
 
 using std::string;
 
-static const string PieceToChar(" PNBRQK  pnbrqk");
-
 CACHE_LINE_ALIGNMENT
 
 Value PieceValue[PHASE_NB][PIECE_NB] = {
 { VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg },
 { VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg } };
 
-static Score psq[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];
-
 namespace Zobrist {
 
   Key psq[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];
@@ -57,6 +53,9 @@ Key Position::exclusion_key() const { return st->key ^ Zobrist::exclusion;}
 
 namespace {
 
+const string PieceToChar(" PNBRQK  pnbrqk");
+Score psq[COLOR_NB][PIECE_TYPE_NB][SQUARE_NB];
+
 // min_attacker() is a helper function used by see() to locate the least
 // valuable attacker for the side to move, remove the attacker we just found
 // from the bitboards and scan for new X-ray attacks behind it.
index 1080d5977104c6d0a6d0d2b791e4b0c25f1d32a0..1d61d073e88a2b973b72eaef21f09caddcac40fc 100644 (file)
@@ -22,7 +22,6 @@
 #include <cstdlib>
 #include <sstream>
 
-#include "evaluate.h"
 #include "misc.h"
 #include "thread.h"
 #include "tt.h"
@@ -36,7 +35,6 @@ namespace UCI {
 
 /// 'On change' actions, triggered by an option's value change
 void on_logger(const Option& o) { start_logger(o); }
-void on_eval(const Option&) { Eval::init(); }
 void on_threads(const Option&) { Threads.read_uci_options(); }
 void on_hash_size(const Option& o) { TT.resize(o); }
 void on_clear_hash(const Option&) { TT.clear(); }