X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=6abef5b47bcb42c764901fdc0cb7a871d7e80039;hb=b36900ef44044e9ab96637c9da7a4d7ea5b055d9;hp=ae63f26343f5026d14dbe989cf65f3e53415546a;hpb=8fb16df70e032c782b6bf81b211e8dab1724a7dc;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index ae63f263..6abef5b4 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -44,9 +44,54 @@ using std::string; using std::cout; using std::endl; -static inline bool isZero(char c) { return c == '0'; } -struct PieceLetters : public std::map { +//// +//// 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 { PieceLetters() { @@ -69,36 +114,11 @@ struct PieceLetters : public std::map { 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) {