Skip to content

Commit

Permalink
Bonus for passed pawns much more advanced than enemy passed pawns
Browse files Browse the repository at this point in the history
  • Loading branch information
Alayan-stk-2 committed Jan 1, 2019
1 parent 69dc556 commit f6bdc83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/evaluate.cpp
Expand Up @@ -161,6 +161,7 @@ namespace {
constexpr Score LongDiagonalBishop = S( 45, 0);
constexpr Score MinorBehindPawn = S( 18, 3);
constexpr Score PawnlessFlank = S( 17, 95);
constexpr Score PawnTempo = S( 0, 4);
constexpr Score RestrictedPiece = S( 7, 7);
constexpr Score RookOnPawn = S( 10, 32);
constexpr Score SliderOnQueen = S( 59, 18);
Expand Down Expand Up @@ -669,6 +670,12 @@ namespace {
k += 4;

bonus += make_score(k * w, k * w);

int rt = pe->passed_pawns(Them) ? relative_rank(Them, frontmost_sq(Them, pe->passed_pawns(Them)))
: RANK_1;
if ( (defendedSquares == squaresToQueen)
&& (r > rt) )
bonus += PawnTempo*w;
}
} // rank > RANK_3

Expand Down

3 comments on commit f6bdc83

@Rocky640
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider this:

// PassedRank[Rank] contains a bonus according to the rank of a passed pawn
  constexpr Score PassedRank[RANK_NB] = {
    S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 62), S(163, 167), S(271, 250)
  };

Let's take a first example:

If white passed pawn is on d5 and black is on h5, white has a S(163,167)-S(57,62) advantage
These values are before we add even more bonus when pawn is clear.
i don,t think that throwing another S(0, 4) would make a difference.

if it would, you can simply tweak the array as follow

  constexpr Score PassedRank[RANK_NB] = {
    S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 60), S(163, 169), S(271, 250)
  };

Let's take a second example:

If black has no passed pawn, you can imply try, again White has already a huge advantage
But you can also try adding S(0, 4) to each term in the array.

In older stockfish, there once was a Unstoppable bonus. for the above reason, it was simplified away.

@Alayan-stk-2
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not S(0,4), it's S(0,4)*w ; with w being 27 on rank 7 and 18 on rank 6.

See Bryan's latest analysis to understand the sort of situation this patch try to improve on.

@Rocky640
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I see, sorry. I will try something.

Please sign in to comment.