1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 09:13:08 +00:00

Passed pawn eval

Use a stepped function to evaluate bonuses and add the bonus to the
middle game

bench: 4857939
This commit is contained in:
jundery 2013-05-05 11:12:04 -06:00
parent 7f4c7cd785
commit 653c0527a7

View file

@ -900,16 +900,30 @@ Value do_evaluate(const Position& pos, Value& margin) {
else else
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them)); unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
// If there aren't enemy attacks or pieces along the path to queen give // Default bonus for the empty square in front
// huge bonus. Even bigger if we protect the pawn's path. int bonusMultiplier = 3;
if (!unsafeSquares)
ebonus += Value(rr * (squaresToQueen == defendedSquares ? 17 : 15)); if ((defendedSquares & SquareBB[blockSq]) != 0)
else {
// OK, there are enemy attacks or pieces (but not pawns). Are those // Defending the square in front
// squares which are attacked by the enemy also attacked by us ? bonusMultiplier += 2;
// If yes, big bonus (but smaller than when there are no enemy attacks), if ((unsafeSquares & defendedSquares) == unsafeSquares)
// if no, somewhat smaller bonus. // Defending all the attacked squares
ebonus += Value(rr * ((unsafeSquares & defendedSquares) == unsafeSquares ? 13 : 8)); // bigger bonus if we are defending everything
bonusMultiplier += (squaresToQueen == defendedSquares) ? 4 : 2;
}
if ((unsafeSquares & SquareBB[blockSq]) == 0)
{
// The square infront isn't attacked
bonusMultiplier += 6;
if (!unsafeSquares)
bonusMultiplier += 6;
}
Value bonus = Value(rr * bonusMultiplier);
ebonus += bonus;
mbonus += bonus;
} }
} // rr != 0 } // rr != 0