#include <sstream>
#include "bitcount.h"
-#include "mersenne.h"
#include "movegen.h"
#include "movepick.h"
#include "position.h"
#include "psqtab.h"
+#include "rkiss.h"
#include "san.h"
#include "tt.h"
#include "ucioption.h"
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 arrays, indexed by Piece
+const Value Position::PieceValueMidgame[17] = {
+ VALUE_ZERO,
+ PawnValueMidgame, KnightValueMidgame, BishopValueMidgame,
+ RookValueMidgame, QueenValueMidgame, VALUE_ZERO,
+ VALUE_ZERO, VALUE_ZERO,
+ PawnValueMidgame, KnightValueMidgame, BishopValueMidgame,
+ RookValueMidgame, QueenValueMidgame
+};
+
+const Value Position::PieceValueEndgame[17] = {
+ VALUE_ZERO,
+ PawnValueEndgame, KnightValueEndgame, BishopValueEndgame,
+ RookValueEndgame, QueenValueEndgame, VALUE_ZERO,
+ VALUE_ZERO, VALUE_ZERO,
+ PawnValueEndgame, KnightValueEndgame, BishopValueEndgame,
+ RookValueEndgame, QueenValueEndgame
+};
+
+// Material values array 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() {
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) {
void Position::init_zobrist() {
+ RKISS RKiss;
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(genrand_int64());
+ zobrist[i][j][k] = RKiss.rand<Key>();
for (i = 0; i < 64; i++)
- zobEp[i] = Key(genrand_int64());
+ zobEp[i] = RKiss.rand<Key>();
for (i = 0; i < 16; i++)
- zobCastle[i] = Key(genrand_int64());
+ zobCastle[i] = RKiss.rand<Key>();
- zobSideToMove = Key(genrand_int64());
- zobExclusion = Key(genrand_int64());
+ zobSideToMove = RKiss.rand<Key>();
+ zobExclusion = RKiss.rand<Key>();
}