X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=ee46279d8957a757f0877421c003c6df2b2020e5;hp=5290efb2c70c2eb4fcd72cfe60ff774ced77000a;hb=4502a1934f2d624288b635b5901ecda8cefa342c;hpb=8463fa479ee2841f852fdf57374b08c87b61e227 diff --git a/src/pawns.cpp b/src/pawns.cpp index 5290efb2..ee46279d 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -43,12 +43,8 @@ namespace { { S(25, 30), S(36, 35), S(40, 35), S(40, 35), S(40, 35), S(40, 35), S(36, 35), S(25, 30) } }; - // Backward pawn penalty by opposed flag and file - const Score Backward[2][FILE_NB] = { - { S(50, 52), S(63, 56), S(69, 56), S(69, 56), - S(69, 56), S(69, 56), S(63, 56), S(50, 52) }, - { S(40, 38), S(49, 41), S(53, 41), S(53, 41), - S(53, 41), S(53, 41), S(49, 41), S(40, 38) } }; + // Backward pawn penalty by opposed flag + const Score Backward[2] = { S(67, 42), S(49, 24) }; // Connected pawn bonus by opposed, phalanx, twice supported and rank Score Connected[2][2][2][RANK_NB]; @@ -151,9 +147,10 @@ namespace { // Test for backward pawn. // If the pawn is passed, isolated, lever or connected it cannot be // backward. If there are friendly pawns behind on adjacent files - // it cannot be backward either. + // or if it is sufficiently advanced, it cannot be backward either. if ( (passed | isolated | lever | connected) - || (ourPawns & pawn_attack_span(Them, s))) + || (ourPawns & pawn_attack_span(Them, s)) + || (relative_rank(Us, s) >= RANK_5)) backward = false; else { @@ -180,17 +177,19 @@ namespace { // Score this pawn if (isolated) score -= Isolated[opposed][f]; + else if (backward) - score -= Backward[opposed][f]; + score -= Backward[opposed]; + else if (!supported) score -= UnsupportedPawnPenalty; if (connected) score += Connected[opposed][!!phalanx][more_than_one(supported)][relative_rank(Us, s)]; - + if (doubled) score -= Doubled[f] / distance(s, frontmost_sq(Us, doubled)); - + if (lever) score += Lever[relative_rank(Us, s)]; }