+// 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);
+
+ struct PieceLetters : public std::map<char, Piece> {
+
+ PieceLetters() {
+
+ operator[]('K') = WK; operator[]('k') = BK;
+ operator[]('Q') = WQ; operator[]('q') = BQ;
+ operator[]('R') = WR; operator[]('r') = BR;
+ operator[]('B') = WB; operator[]('b') = BB;
+ operator[]('N') = WN; operator[]('n') = BN;
+ operator[]('P') = WP; operator[]('p') = BP;
+ operator[](' ') = PIECE_NONE;
+ operator[]('.') = PIECE_NONE_DARK_SQ;
+ }
+
+ char from_piece(Piece p) const {