]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Use namespace in position.cpp
[stockfish] / src / position.cpp
index e6261d3c661e9be9af618ec05e2e97c4aeab7d30..b5503cb501fbbcac919ae542231942203ec8f2eb 100644 (file)
@@ -44,9 +44,35 @@ using std::string;
 using std::cout;
 using std::endl;
 
-static inline bool isZero(char c) { return c == '0'; }
 
-struct PieceLetters : public std::map<char, Piece> {
+////
+//// Position's static data definitions
+////
+
+Key Position::zobrist[2][8][64];
+Key Position::zobEp[64];
+Key Position::zobCastle[16];
+Key Position::zobSideToMove;
+Key Position::zobExclusion;
+
+Score Position::PieceSquareTable[16][64];
+
+// Material values used by SEE, indexed by PieceType
+const Value Position::seeValues[] = {
+    VALUE_ZERO,
+    PawnValueMidgame, KnightValueMidgame, BishopValueMidgame,
+    RookValueMidgame, QueenValueMidgame, QueenValueMidgame*10
+};
+
+
+namespace {
+
+  // Bonus for having the side to move (modified by Joona Kiiski)
+  const Score TempoValue = make_score(48, 22);
+
+  bool isZero(char c) { return c == '0'; }
+
+  struct PieceLetters : public std::map<char, Piece> {
 
     PieceLetters() {
 
@@ -69,36 +95,11 @@ struct PieceLetters : public std::map<char, Piece> {
         assert(false);
         return 0;
     }
-};
-
-
-////
-//// Constants and variables
-////
-
-/// Bonus for having the side to move (modified by Joona Kiiski)
-
-static const Score TempoValue = make_score(48, 22);
-
-
-Key Position::zobrist[2][8][64];
-Key Position::zobEp[64];
-Key Position::zobCastle[16];
-Key Position::zobSideToMove;
-Key Position::zobExclusion;
-
-Score Position::PieceSquareTable[16][64];
-
-static PieceLetters pieceLetters;
-
-// Material values used by SEE, indexed by PieceType
-const Value Position::seeValues[] = {
-  VALUE_ZERO, PawnValueMidgame, KnightValueMidgame, BishopValueMidgame,
-  RookValueMidgame, QueenValueMidgame, QueenValueMidgame*10
-};
+  } pieceLetters;
+}
 
 
-/// Constructors
+/// CheckInfo c'tor
 
 CheckInfo::CheckInfo(const Position& pos) {
 
@@ -1763,16 +1764,16 @@ void Position::init_zobrist() {
   int i,j, k;
 
   for (i = 0; i < 2; i++) for (j = 0; j < 8; j++) for (k = 0; k < 64; k++)
-      zobrist[i][j][k] = Key(RKiss.rand64());
+      zobrist[i][j][k] = RKiss.rand<Key>();
 
   for (i = 0; i < 64; i++)
-      zobEp[i] = Key(RKiss.rand64());
+      zobEp[i] = RKiss.rand<Key>();
 
   for (i = 0; i < 16; i++)
-      zobCastle[i] = Key(RKiss.rand64());
+      zobCastle[i] = RKiss.rand<Key>();
 
-  zobSideToMove = Key(RKiss.rand64());
-  zobExclusion  = Key(RKiss.rand64());
+  zobSideToMove = RKiss.rand<Key>();
+  zobExclusion  = RKiss.rand<Key>();
 }