From: Fabian Fichter Date: Sat, 9 Feb 2019 17:28:16 +0000 (+0100) Subject: Merge official-stockfish/master X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=5d57840a2c726e90ab42e717276706a1e9834425;p=fairystockfish.git Merge official-stockfish/master bench: 5031310 --- 5d57840a2c726e90ab42e717276706a1e9834425 diff --cc src/evaluate.cpp index 31c966b,f418668..61342d8 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@@ -158,17 -152,14 +158,17 @@@ namespace }; // PassedDanger[Rank] contains a term to weight the passed score - constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 2, 7, 12, 19 }; + constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 }; + // KingProximity contains a penalty according to distance from king + constexpr Score KingProximity = S(2, 2); + // KingProtector[knight/bishop] contains a penalty according to distance from king - constexpr Score KingProtector[] = { S(4, 6), S(6, 3) }; + constexpr Score KingProtector[] = { S(5, 6), S(6, 5) }; // Assorted bonuses and penalties - constexpr Score BishopPawns = S( 3, 5); - constexpr Score CloseEnemies = S( 8, 0); + constexpr Score BishopPawns = S( 3, 7); + constexpr Score CloseEnemies = S( 6, 0); constexpr Score Connectivity = S( 3, 1); constexpr Score CorneredBishop = S( 50, 50); constexpr Score Hanging = S( 52, 30); @@@ -558,12 -470,12 +557,12 @@@ unsafeChecks &= mobilityArea[Them]; kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them] - + 64 * kingAttacksCount[Them] * (1 + 2 * !!pos.max_check_count()) - + 183 * popcount(kingRing[Us] & weak) * (1 + pos.captures_to_hand() + !!pos.max_check_count()) - + 122 * popcount(pos.blockers_for_king(Us) | unsafeChecks) - - 860 * !(pos.count(Them) || pos.captures_to_hand()) / (1 + !!pos.max_check_count()) - - 7 * mg_value(score) / 8 - + 17; - + 69 * kingAttacksCount[Them] - + 185 * popcount(kingRing[Us] & weak) ++ + 69 * kingAttacksCount[Them] * (1 + 2 * !!pos.max_check_count()) ++ + 185 * popcount(kingRing[Us] & weak) * (1 + pos.captures_to_hand() + !!pos.max_check_count()) + + 129 * popcount(pos.blockers_for_king(Us) | unsafeChecks) - - 873 * !pos.count(Them) ++ - 873 * !(pos.count(Them) || pos.captures_to_hand()) / (1 + !!pos.max_check_count()) + - 6 * mg_value(score) / 8 - - 2 ; ++ - 2; // Transform the kingDanger units into a Score, and subtract it from the evaluation if (kingDanger > 0) diff --cc src/position.cpp index a5d4c44,84c7ae8..f96a66a --- a/src/position.cpp +++ b/src/position.cpp @@@ -181,24 -167,14 +181,26 @@@ void Position::init() Zobrist::side = rng.rand(); Zobrist::noPawns = rng.rand(); + for (Color c = WHITE; c <= BLACK; ++c) + for (int n = 0; n < CHECKS_NB; ++n) + Zobrist::checks[c][n] = rng.rand(); + + for (Color c = WHITE; c <= BLACK; ++c) + for (PieceType pt = PAWN; pt <= KING; ++pt) + for (int n = 0; n < SQUARE_NB; ++n) + Zobrist::inHand[make_piece(c, pt)][n] = rng.rand(); + // Prepare the cuckoo tables + std::memset(cuckoo, 0, sizeof(cuckoo)); + std::memset(cuckooMove, 0, sizeof(cuckooMove)); int count = 0; - for (Piece pc : Pieces) - for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) - for (Square s2 = Square(s1 + 1); s2 <= SQ_H8; ++s2) - if (PseudoAttacks[type_of(pc)][s1] & s2) + for (Color c = WHITE; c <= BLACK; ++c) + for (PieceType pt = KNIGHT; pt <= QUEEN || pt == KING; pt != QUEEN ? ++pt : pt = KING) + { + Piece pc = make_piece(c, pt); + for (Square s1 = SQ_A1; s1 <= SQ_MAX; ++s1) + for (Square s2 = Square(s1 + 1); s2 <= SQ_MAX; ++s2) + if (PseudoAttacks[WHITE][type_of(pc)][s1] & s2) { Move move = make_move(s1, s2); Key key = Zobrist::psq[pc][s1] ^ Zobrist::psq[pc][s2] ^ Zobrist::side;