X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=b5b51d2cdc6ddecd295b0d1474b683436bbe1a82;hp=46d9151ff1401add0287b416770108a729abf606;hb=fdbe8006e058f3d2852117045be51b8841daa16f;hpb=b84af67f4c88f3e3f7b61bf2035475f79fb3e62e diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 46d9151f..b5b51d2c 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -138,7 +138,7 @@ namespace { {}, {}, { S(0, 0), S( 7, 39), S( 0, 0), S(24, 49), S(41,100), S(41,100) }, // KNIGHT { S(0, 0), S( 7, 39), S(24, 49), S( 0, 0), S(41,100), S(41,100) }, // BISHOP - { S(0, 0), S(-1, 29), S(15, 49), S(15, 49), S( 0, 0), S(24, 49) }, // ROOK + { S(0, 0), S( 0, 22), S(15, 49), S(15, 49), S( 0, 0), S(24, 49) }, // ROOK { S(0, 0), S(15, 39), S(15, 39), S(15, 39), S(15, 39), S( 0, 0) } // QUEEN }; @@ -153,12 +153,16 @@ namespace { // Bonus for having the side to move (modified by Joona Kiiski) const Score Tempo = make_score(24, 11); - // Rooks and queens on the 7th rank (modified by Joona Kiiski) - const Score RookOn7thBonus = make_score(47, 98); - const Score QueenOn7thBonus = make_score(27, 54); + // Rooks and queens on the 7th rank + const Score RookOn7thBonus = make_score(3, 20); + const Score QueenOn7thBonus = make_score(1, 8); + + // Rooks and queens attacking pawns on the same rank + const Score RookOnPawnBonus = make_score(3, 48); + const Score QueenOnPawnBonus = make_score(1, 40); // Rooks on open files (modified by Joona Kiiski) - const Score RookOpenFileBonus = make_score(43, 21); + const Score RookOpenFileBonus = make_score(43, 21); const Score RookHalfOpenFileBonus = make_score(19, 10); // Penalty for rooks trapped inside a friendly king which has lost the @@ -595,12 +599,18 @@ Value do_evaluate(const Position& pos, Value& margin) { && !(pos.pieces(Them, PAWN) & attack_span_mask(Us, s))) score += evaluate_outposts(pos, ei, s); - // Queen or rook on 7th rank - if ( (Piece == ROOK || Piece == QUEEN) - && relative_rank(Us, s) == RANK_7 - && relative_rank(Us, pos.king_square(Them)) == RANK_8) + if ((Piece == ROOK || Piece == QUEEN) && relative_rank(Us, s) >= RANK_5) { - score += (Piece == ROOK ? RookOn7thBonus : QueenOn7thBonus); + // Major piece on 7th rank + if ( relative_rank(Us, s) == RANK_7 + && relative_rank(Us, pos.king_square(Them)) == RANK_8) + score += (Piece == ROOK ? RookOn7thBonus : QueenOn7thBonus); + + // Major piece attacking pawns on the same rank + Bitboard pawns = pos.pieces(Them, PAWN) & rank_bb(s); + if (pawns) + score += (Piece == ROOK ? RookOnPawnBonus + : QueenOnPawnBonus) * popcount(pawns); } // Special extra evaluation for bishops