1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-13 12:39:16 +00:00

Another micro-optmization in valuate_passed_pawns()

very small gain, but still a gain at the cost of
an extra indentation level.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-01-07 14:17:50 +01:00
parent 9b87d151bc
commit 5cacefe7c6

View file

@ -932,12 +932,14 @@ namespace {
Value ebonus = Value(10 + r * r * 10);
// Adjust bonus based on king proximity
if (tr != 0)
{
ebonus -= Value(square_distance(ourKingSq, blockSq) * 3 * tr);
ebonus -= Value(square_distance(ourKingSq, blockSq + pawn_push(us)) * 1 * tr);
ebonus += Value(square_distance(theirKingSq, blockSq) * 6 * tr);
// If the pawn is free to advance, increase bonus
if (tr != 0 && pos.square_is_empty(blockSq))
if (pos.square_is_empty(blockSq))
{
b2 = squares_in_front_of(us, s);
b3 = b2 & ei.attacked_by(them);
@ -977,6 +979,7 @@ namespace {
if ((b2 & pos.pieces_of_color(us)) == EmptyBoardBB)
ebonus += Value(tr);
}
}
// If the pawn is supported by a friendly pawn, increase bonus
b2 = pos.pawns(us) & neighboring_files_bb(s);