Passed Pawns (endgame)

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

[d] 8/P7/4k3/8/5P2/4Bq2/5P2/5K2 b - - 0 1
1…Kf5 2.Ke1(g1) Qd5 3.Kf1 (3.Ke2 Kg4) Ke4 4.Kg2 (4.Ke2 Qa2+) Qg8+ 5.Kf1 Kf3 6.Ke1 Qa2 7.Kd1 Ke4 8.Ke1 Kd3 9.Kf1 Qd5 10.Kg1 Ke2 win
Probably all engines would play 1…Kd7 ?? :(

Monte Carlo Analysis in Rybka 4: yields precise evaluations by playing thousands of ultra-fast games in a few minutes in a given position. This is very much like using game result statistics, something human players do when choosing their opening variations. Monte Carlo Analysis can be used in any position, but generally it's most useful in two types of positions:
1) Endgames. Many engines often give high scores to drawn endgames (and sometimes low scores to winning ones). Monte Carlo recognizes fortresses and other no-progress situations. :D It's also good in Rook endgames, which are another computer problem.
2) Positions. There are games where one side has made a big material sacrifice for slow compensation (i.e. not just tactics). For instance you can find lots of piece sacrifices in famous Grandmaster chess games which no computer will correctly appreciate - but which Monte Carlo gets right.[/b]
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Passed Pawns (endgame)

Post by mcostalba »

Ralph Stoesser wrote: Not that I would claim that the passed pawn code is somehow optimal, but such a patch most likely wouldn't make the code significant more messy as it already is. The code to evaluate enemy control over squares in front of our passed pawn is already there.
In this case the priority is to _first_ try to make the code less messy ;-)

BTW it didn't seem so messy to me the last time I looked at it....maybe you can come up with a clean-up patch (theese are greatly appreciated by me).
Ralph Stoesser
Posts: 408
Joined: Sat Mar 06, 2010 9:28 am

Re: Passed Pawns (endgame)

Post by Ralph Stoesser »

mcostalba wrote:
Ralph Stoesser wrote: Not that I would claim that the passed pawn code is somehow optimal, but such a patch most likely wouldn't make the code significant more messy as it already is. The code to evaluate enemy control over squares in front of our passed pawn is already there.
In this case the priority is to _first_ try to make the code less messy ;-)
Thank you. I was waiting for this comment.
I agree. In the real world, where time and money matters, I would do both, clean up + bug fixing, at the same time frame.
BTW it didn't seem so messy to me the last time I looked at it....maybe you can come up with a clean-up patch (theese are greatly appreciated by me).
I just want to remind you that the term "messy" originate from Joona. I also cannot spot major messy parts in the passed pawn code. The local bitboard variable names b, b2, b3, b4 are not exactly telling, but they are short instead, which also is a good thing. Personally I would not label variables like this, but that's a minor issue. Also that would be easy to "cleen up". So to me at first it's questionable whether it would pay to invest much work here. But maybe Joona can come up with a clean-up patch. These are greatly appreciated, also by me as a SF fan :wink:
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Passed Pawns (endgame)

Post by Sven »

Ralph Stoesser wrote:
mcostalba wrote:
Ralph Stoesser wrote: Not that I would claim that the passed pawn code is somehow optimal, but such a patch most likely wouldn't make the code significant more messy as it already is. The code to evaluate enemy control over squares in front of our passed pawn is already there.
In this case the priority is to _first_ try to make the code less messy ;-)
Thank you. I was waiting for this comment.
I agree. In the real world, where time and money matters, I would do both, clean up + bug fixing, at the same time frame.
BTW it didn't seem so messy to me the last time I looked at it....maybe you can come up with a clean-up patch (theese are greatly appreciated by me).
I just want to remind you that the term "messy" originate from Joona. I also cannot spot major messy parts in the passed pawn code. The local bitboard variable names b, b2, b3, b4 are not exactly telling, but they are short instead, which also is a good thing. Personally I would not label variables like this, but that's a minor issue. Also that would be easy to "cleen up". So to me at first it's questionable whether it would pay to invest much work here. But maybe Joona can come up with a clean-up patch. These are greatly appreciated, also by me as a SF fan :wink:
As a first step, here is my "cleanup proposal" for the evaluate_passed_pawns_of_color() function. No functional change or "fix" at all yet, only an attempt of restructuring the same code into smaller functions, most of them getting inlined.

Old size of evaluate_passed_pawns_of_color() function: 127 lines, starting at line 873 in evaluate.cpp (SF 1.7.1)
New size (6 functions): 163 lines replacing the old 127 lines

Second step, if the SF team would agree to a local and non-functional change like this, would be that we come up with a proposal addressing the "king proximity" issue I brought up. But the first step could also persist without the second, I think.

Comments are welcome!

Sven

Code: Select all

  // evaluate_king_proximity_to_passed_pawn() evaluates the proximity of both kings to the given passed pawn

  template<Color Us>
  inline void evaluate_king_proximity_to_passed_pawn&#40;
          Square s, Square blockSq, Square ourKingSq, Square theirKingSq, int tr, Value & ebonus&#41; &#123;

      ebonus -= Value&#40;square_distance&#40;ourKingSq, blockSq&#41; * 3 * tr&#41;;
      ebonus -= Value&#40;square_distance&#40;ourKingSq, blockSq + pawn_push&#40;Us&#41;) * 1 * tr&#41;;
      ebonus += Value&#40;square_distance&#40;theirKingSq, blockSq&#41; * 6 * tr&#41;;
  &#125;

  // evaluate_promotion_path_of_passed_pawn&#40;) evaluates properties of the promotion path of the
  // given passed pawn

  template<Color Us>
  inline void evaluate_promotion_path_of_passed_pawn&#40;
          const Position& pos, Square s, Square blockSq, int tr, const EvalInfo& ei, Value & ebonus&#41; &#123;

      // If the pawn is free to advance, increase bonus
      if &#40;pos.square_is_empty&#40;blockSq&#41;)
      &#123;
          // There are no enemy pawns in the pawn's path
          Bitboard pathBB = squares_in_front_of&#40;Us, s&#41;;

          assert&#40;&#40;pathBB & pos.pieces&#40;PAWN, Them&#41;) == EmptyBoardBB&#41;;

          // Squares attacked by us
          Bitboard pathProtectedBB = pathBB & ei.attacked_by&#40;Us&#41;;

          // Squares attacked or occupied by enemy pieces
          Bitboard pathImpactedBB = pathBB & &#40;ei.attacked_by&#40;Them&#41; | pos.pieces_of_color&#40;Them&#41;);

          // If there is an enemy rook or queen attacking the pawn from behind,
          // add all X-ray attacks by the rook or queen.
          if (   &#40;squares_behind&#40;Us, s&#41; & pos.pieces&#40;ROOK, QUEEN, Them&#41;)
              && &#40;squares_behind&#40;Us, s&#41; & pos.pieces&#40;ROOK, QUEEN, Them&#41; & pos.attacks_from<QUEEN>&#40;s&#41;))
              pathImpactedBB = pathBB;

          // Are any of the squares in the pawn's path attacked or occupied by the enemy?
          if &#40;pathImpactedBB == EmptyBoardBB&#41;
              // No enemy attacks or pieces, huge bonus!
              // Even bigger if we protect the pawn's path
              ebonus += Value&#40;tr * &#40;pathBB == pathProtectedBB ? 17 &#58; 15&#41;);
          else
              // OK, there are enemy attacks or pieces &#40;but not pawns&#41;. Are those
              // squares which are attacked by the enemy also attacked by us ?
              // If yes, big bonus &#40;but smaller than when there are no enemy attacks&#41;,
              // if no, somewhat smaller bonus.
              ebonus += Value&#40;tr * (&#40;pathImpactedBB & pathProtectedBB&#41; == pathImpactedBB ? 13 &#58; 8&#41;);

          // At last, add a small bonus when there are no *friendly* pieces
          // in the pawn's path.
          if (&#40;pathBB & pos.pieces_of_color&#40;Us&#41;) == EmptyBoardBB&#41;
              ebonus += Value&#40;tr&#41;;
      &#125;
  &#125;

  // evaluate_supported_passed_pawn&#40;) evaluates a passed pawn which is supported by a friendly pawn

  template<Color Us>
  inline void evaluate_supported_passed_pawn&#40;const Position& pos, Square s, int r, Value & ebonus&#41; &#123;

      // If the pawn is supported by a friendly pawn, increase bonus
      Bitboard neighboursOfPassedPawnBB = pos.pieces&#40;PAWN, Us&#41; & neighboring_files_bb&#40;s&#41;;
      if &#40;neighboursOfPassedPawnBB & rank_bb&#40;s&#41;)
          ebonus += Value&#40;r * 20&#41;;
      else if &#40;pos.attacks_from<PAWN>&#40;s, Them&#41; & neighboursOfPassedPawnBB&#41;
          ebonus += Value&#40;r * 12&#41;;
  &#125;

  // evaluate_unstoppable_passed_pawn&#40;) checks whether the given passed pawn is unstoppable,
  // and if it is, sets the movesToGo&#91;&#93; and pawnToGo&#91;&#93; values for the given color

  template<Color Us>
  inline void evaluate_unstoppable_passed_pawn&#40;
           const Position& pos, Square s, Square theirKingSq, Color Them, int movesToGo&#91;&#93;, Square pawnToGo&#91;&#93;) &#123;

      // If the other side has only a king, check whether the pawn is unstoppable
      if &#40;pos.non_pawn_material&#40;Them&#41; == Value&#40;0&#41;)
      &#123;
          Square qsq = relative_square&#40;Us, make_square&#40;square_file&#40;s&#41;, RANK_8&#41;);
          int d =  square_distance&#40;s, qsq&#41;
                 - square_distance&#40;theirKingSq, qsq&#41;
                 + int&#40;Us != pos.side_to_move&#40;));

          if &#40;d < 0&#41;
          &#123;
              int mtg = RANK_8 - relative_rank&#40;Us, s&#41;;
              int blockerCount = count_1s_max_15&#40;squares_in_front_of&#40;Us,s&#41; & pos.occupied_squares&#40;));
              mtg += blockerCount;
              d += blockerCount;
              if &#40;d < 0 && (!movesToGo&#91;Us&#93; || movesToGo&#91;Us&#93; > mtg&#41;)
              &#123;
                  movesToGo&#91;Us&#93; = mtg;
                  pawnToGo&#91;Us&#93; = s;
              &#125;
          &#125;
      &#125;
  &#125;

  // evaluate_rook_passed_pawns&#40;) evaluates the passed pawns of the given color that are on rook files

  template<Color Us>
  inline void evaluate_rook_passed_pawns&#40;const Position& pos, Square s, Color Them, Value & ebonus&#41; &#123;

      // Rook pawns are a special case&#58; They are sometimes worse, and
      // sometimes better than other passed pawns. It is difficult to find
      // good rules for determining whether they are good or bad. For now,
      // we try the following&#58; Increase the value for rook pawns if the
      // other side has no pieces apart from a knight, and decrease the
      // value if the other side has a rook or queen.
      if &#40;square_file&#40;s&#41; == FILE_A || square_file&#40;s&#41; == FILE_H&#41;
      &#123;
          if (   pos.non_pawn_material&#40;Them&#41; <= KnightValueMidgame
              && pos.piece_count&#40;Them, KNIGHT&#41; <= 1&#41;
              ebonus += ebonus / 4;
          else if &#40;pos.pieces&#40;ROOK, QUEEN, Them&#41;)
              ebonus -= ebonus / 4;
      &#125;
  &#125;

  // evaluate_passed_pawns_of_color&#40;) evaluates the passed pawns of the given color

  template<Color Us>
  void evaluate_passed_pawns_of_color&#40;const Position& pos, int movesToGo&#91;&#93;, Square pawnToGo&#91;&#93;, EvalInfo& ei&#41; &#123;

    const Color Them = &#40;Us == WHITE ? BLACK &#58; WHITE&#41;;

    Square ourKingSq = pos.king_square&#40;Us&#41;;
    Square theirKingSq = pos.king_square&#40;Them&#41;;
    Bitboard ourPassedPawnsBB = ei.pi->passed_pawns&#40;) & pos.pieces&#40;PAWN, Us&#41;;

    while &#40;ourPassedPawnsBB&#41;
    &#123;
        Square s = pop_1st_bit&#40;&ourPassedPawnsBB&#41;;

        assert&#40;pos.piece_on&#40;s&#41; == piece_of_color_and_type&#40;Us, PAWN&#41;);
        assert&#40;pos.pawn_is_passed&#40;Us, s&#41;);

        int r = int&#40;relative_rank&#40;Us, s&#41; - RANK_2&#41;;
        int tr = Max&#40;0, r * &#40;r - 1&#41;);

        // Base bonus based on rank
        Value mbonus = Value&#40;20 * tr&#41;;
        Value ebonus = Value&#40;10 + r * r * 10&#41;;

        // Adjust bonus based on king proximity
        if &#40;tr&#41;
        &#123;
            Square blockSq = s + pawn_push&#40;Us&#41;;
            evaluate_king_proximity_to_passed_pawn&#40;     s, blockSq, ourKingSq, theirKingSq, tr,     ebonus&#41;;
            evaluate_promotion_path_of_passed_pawn&#40;pos, s, blockSq,                         tr, ei, ebonus&#41;;
        &#125;

        evaluate_supported_passed_pawn  &#40;pos, s, r,                 ebonus&#41;;
        evaluate_unstoppable_passed_pawn&#40;pos, s, theirKingSq, Them, movesToGo, pawnToGo&#41;;
        evaluate_rook_passed_pawns      &#40;pos, s,              Them, ebonus&#41;;

        // Add the scores for this pawn to the middle game and endgame eval.
        ei.value += Sign&#91;Us&#93; * apply_weight&#40;make_score&#40;mbonus, ebonus&#41;, WeightPassedPawns&#41;;
    &#125;
  &#125;
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Passed Pawns (endgame)

Post by mcostalba »

Sven Schüle wrote: Comments are welcome!
Thanks Sven, but I prefer to keep the whole function in one chunk, it is easier (for me) to understand what's going on.

This is my attempt. This is a "no functional change" but I have added 3 FIXME that corresponds to 3 tests to be done one after the other and NOT togheter, that could yield or to an ELO increase or to a code simplification....there is material for one week of tests here ;-)

Code: Select all

   template<Color Us>
  void evaluate_passed_pawns&#40;const Position& pos, EvalInfo& ei&#41; &#123;

    const Color Them = &#40;Us == WHITE ? BLACK &#58; WHITE&#41;;

    Bitboard squaresToQueen, defendedSquares, unsafeSquares, supportingPawns;
    Bitboard b = ei.pi->passed_pawns&#40;) & pos.pieces_of_color&#40;Us&#41;;

    while &#40;b&#41;
    &#123;
        Square s = pop_1st_bit&#40;&b&#41;;

        assert&#40;pos.piece_on&#40;s&#41; == piece_of_color_and_type&#40;Us, PAWN&#41;);
        assert&#40;pos.pawn_is_passed&#40;Us, s&#41;);

        int r = int&#40;relative_rank&#40;Us, s&#41; - RANK_2&#41;;
        int tr = Max&#40;0, r * &#40;r - 1&#41;);

        // Base bonus based on rank
        Value mbonus = Value&#40;20 * tr&#41;;
        Value ebonus = Value&#40;10 + r * r * 10&#41;;

        if &#40;tr&#41;
        &#123;
            Square blockSq = s + pawn_push&#40;Us&#41;;

            // Adjust bonus based on kings proximity to the blocking square
            ebonus -= Value&#40;square_distance&#40;pos.king_square&#40;Us&#41;, blockSq&#41; * 3 * tr&#41;;
            ebonus -= Value&#40;square_distance&#40;pos.king_square&#40;Us&#41;, blockSq + pawn_push&#40;Us&#41;) * 1 * tr&#41;;
            ebonus += Value&#40;square_distance&#40;pos.king_square&#40;Them&#41;, blockSq&#41; * 6 * tr&#41;;

            // If the pawn is free to advance, increase bonus
            if &#40;pos.square_is_empty&#40;blockSq&#41;)
            &#123;
                squaresToQueen = squares_in_front_of&#40;Us, s&#41;;
                defendedSquares = squaresToQueen & ei.attacked_by&#40;Us&#41;;

                // There are no enemy pawns in the pawn's path
                assert&#40;!&#40;squaresToQueen & pos.pieces&#40;PAWN, Them&#41;));

                // If there is an enemy rook or queen attacking the pawn from behind,
                // add all X-ray attacks by the rook or queen. Otherwise consider only
                // the squares in the pawn's path attacked or occupied by the enemy.
                if (   &#40;squares_behind&#40;Us, s&#41; & pos.pieces&#40;ROOK, QUEEN, Them&#41;)
                    && &#40;squares_behind&#40;Us, s&#41; & pos.pieces&#40;ROOK, QUEEN, Them&#41; & pos.attacks_from<QUEEN>&#40;s&#41;))
                    unsafeSquares = squaresToQueen;
                else
                    unsafeSquares = squaresToQueen & &#40;ei.attacked_by&#40;Them&#41; | pos.pieces_of_color&#40;Them&#41;);

                // If there aren't enemy attacks or pieces along the path to queen give
                // huge bonus. Even bigger if we protect the pawn's path.
                if (!unsafeSquares&#41;
                    ebonus += Value&#40;tr * &#40;squaresToQueen == defendedSquares ? 17 &#58; 15&#41;);

                /* FIXME skip bonus when blockSq is unsafe and undefended

                   else if (!bit_is_set&#40;unsafeSquares & ~defendedSquares&#41;, blockSq&#41;
                */
                else 
                    // OK, there are enemy attacks or pieces &#40;but not pawns&#41;. Are those
                    // squares which are attacked by the enemy also attacked by us ?
                    // If yes, big bonus &#40;but smaller than when there are no enemy attacks&#41;,
                    // if no, somewhat smaller bonus.
                    ebonus += Value&#40;tr * (&#40;unsafeSquares & defendedSquares&#41; == unsafeSquares ? 13 &#58; 8&#41;);

                // At last, add a small bonus when there are no *friendly* pieces
                // in the pawn's path.
                if (!&#40;squaresToQueen & pos.pieces_of_color&#40;Us&#41;))
                    ebonus += Value&#40;tr&#41;;
            &#125;
        &#125; // tr != 0

        // Increase the bonus if the passed pawn is supported by a friendly pawn.
        // Give a good bonus if the friendly pawn is on the same rank and a bit
        // smaller bonus if it's on the previous rank.
        supportingPawns = pos.pieces&#40;PAWN, Us&#41; & neighboring_files_bb&#40;s&#41;;
        if &#40;supportingPawns & rank_bb&#40;s&#41;)
            ebonus += Value&#40;r * 20&#41;;
        else if &#40;supportingPawns & rank_bb&#40;s - pawn_push&#40;Us&#41;)) // FIXME remove 'else'
            ebonus += Value&#40;r * 12&#41;;

        // Rook pawns are a special case&#58; They are sometimes worse, and
        // sometimes better than other passed pawns. It is difficult to find
        // good rules for determining whether they are good or bad. For now,
        // we try the following&#58; Increase the value for rook pawns if the
        // other side has no pieces apart from a knight, and decrease the
        // value if the other side has a rook or queen.
        if &#40;square_file&#40;s&#41; == FILE_A || square_file&#40;s&#41; == FILE_H&#41; // FIXME remove this ugly special case
        &#123;
            if (   pos.non_pawn_material&#40;Them&#41; <= KnightValueMidgame
                && pos.piece_count&#40;Them, KNIGHT&#41; <= 1&#41;
                ebonus += ebonus / 4;
            else if &#40;pos.pieces&#40;ROOK, QUEEN, Them&#41;)
                ebonus -= ebonus / 4;
        &#125;

        // Add the scores for this pawn to the middle game and endgame eval
        ei.value += Sign&#91;Us&#93; * apply_weight&#40;make_score&#40;mbonus, ebonus&#41;, Weights&#91;PassedPawns&#93;);

    &#125; // while
  &#125;
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

zamar wrote:One should almost never consider changing code because of one test position :)
100 point bonus [passed pawns (endgame)] makes correct play more difficult (time-consuming) or impossible, if opposite Pawn reached 7(2) line, and King should be active.

Example (one of many tested by me):
[d] 8/6kP/1p4B1/8/2Pp4/8/3K4/r7 b - - 0 1
correct play: 1...Rh1 and next Kg7->f6->e5 e.g. 2.Be4 Rh3 3.Bf5 Rh2+ 4.Kd3 Kf6 5.Be4 Ke5 6.Bg6 Rh3+ 7.Kd2 Kf4 8.Ke2 Rh2+ 9.Kd3 Ke5 -+

Analysis by Stockfish 1.7.1 JA [passed pawns (endgame) =100]:
1...Kh8
-+ (-3.07) Depth: 1 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4.Bf5
-+ (-3.07) Depth: 6 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4.Bf5
-+ (-3.07) Depth: 6 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4.Bf5
-+ (-3.07) Depth: 6 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4.Bf5
-+ (-3.07) Depth: 6 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4.Bf5
-+ (-3.07) Depth: 6 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4.Bf5
-+ (-3.07) Depth: 6 00:00:01
1...Ra3 2.Bf5 Kh8 3.Be4 Rh3 4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 6.Kd2 Rh3
-+ (-3.15) Depth: 9 00:00:01 35kN
1...Rh1 2.Be4 Rh3 3.Bc2 Kf6 4.Ke2 Ke5 5.Bd3 Rh2+ 6.Kf3 Rh6 7.Be4 Rh4 8.Bd3 Rf4+ 9.Kg3
-+ (-3.03) Depth: 10 00:00:01 44kN
1...Rh1 2.Be4 Rh3 3.Bc2 Kf6 4.Ke2 Ke5 5.Bd3 Rh2+ 6.Kf3 Rh6 7.Be4 Rh4 8.Bd3 Rf4+ 9.Kg3
-+ (-3.03) Depth: 11 00:00:01 53kN
1...Rh1 2.Bc2 Rh3 3.Be4 Kf6 4.Ke2 Ke5 5.Bd3 Kf4 6.Bg6 Rh2+ 7.Kd3 Ke5
-+ (-3.11) Depth: 12 00:00:01 69kN
1...Rh1 2.Be4 Rh3 3.Bc2 Kf6 4.Ke2 Ke5 5.Bd3 Kf4 6.Bg6 Rh2+ 7.Kd3 Ke5
-+ (-3.19) Depth: 12 00:00:01 74kN
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Passed Pawns (endgame)

Post by Sven »

lech wrote:
zamar wrote:One should almost never consider changing code because of one test position :)
100 point bonus [passed pawns (endgame)] makes correct play more difficult (time-consuming) or impossible, if opposite Pawn reached 7(2) line, and King should be active.

Example (one of many tested by me):
[d] 8/6kP/1p4B1/8/2Pp4/8/3K4/r7 b - - 0 1
correct play: 1...Rh1 and next Kg7->f6->e5 e.g. 2.Be4 Rh3 3.Bf5 Rh2+ 4.Kd3 Kf6 5.Be4 Ke5 6.Bg6 Rh3+ 7.Kd2 Kf4 8.Ke2 Rh2+ 9.Kd3 Ke5 -+

Analysis by Stockfish 1.7.1 JA [passed pawns (endgame) =100]:
[...]
1...Rh1 2.Bc2 Rh2+ 3.Kd3 Kxh7 4.Ba4 Rh4 5.Bc6 Kg7 6.Be4 Kf6 7.Kxd4 Ke6 8.Kd3 Ke5 9.Bc6 Rh3+ 10.Kd2 Rg3 11.Ke2 Rc3 12.Bd5 Kd4
-+ (-3.15) Depth: 31 00:02:13 46211kN
1...Rh1 2.Be4 Rh3 3.Bf5 Rh2+ 4.Kd3 Kf6 5.Be4 Ke5 6.Bg6 Rh3+ 7.Ke2 Kf4 8.Kd2 Rh2+ 9.Kd3 Ke5 10.Bf5 Kxf5

Analysis by Stockfish 1.7.1 JA [passed pawns (endgame) =0; Hash=clear]:
[...]
1...Rh1 2.Bc2 Rh3 3.Be4 Kf6 4.Ke2 Ke5 5.Bd3 Kf4 6.Bg6 Rh2+ 7.Kd3 Ke5
-+ (-3.11) Depth: 12 00:00:01 69kN
1...Rh1 2.Be4 Rh3 3.Bc2 Kf6 4.Ke2 Ke5 5.Bd3 Kf4 6.Bg6 Rh2+ 7.Kd3 Ke5
-+ (-3.19) Depth: 12 00:00:01 74kN
Your first test position from the beginning of this thread was better since there Stockfish does not even find a winning line with search in case of default settings - assuming the analysis of the winning plan you have shown is correct, which I did not check in detail. In the new position above, SF needs roughly 2 seconds on your system to find Rh1 followed by king activation. So in this new case, as you mentioned, a possible improvement that helps to evaluate the position with active king correctly would "only" affect the search time but not the result.

I agree to your opinion that there may be some room for improvement of the passed pawns evaluation of SF, and I had already described in detail what I believe is the root cause of that behaviour. Currently we'll have to accept that the SF team considers this as a case too special for adding more code, which I can fully understand although I have a different opinion.

Please note again, however, that you are probably still misinterpreting the meaning of the UCI parameter "Passed pawns (endgame)" that you have been playing with. It is not an absolute bonus but a weight, which can make a huge difference. See my first reply in this thread. Setting that weight to 0 is of course *not* a valid option for the general case, since that would nearly disable all passed pawn evaluations in all endgames.

Sven
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

Sven Schüle wrote:
lech wrote:
zamar wrote:One should almost never consider changing code because of one test position :)
100 point bonus [passed pawns (endgame)] makes correct play more difficult (time-consuming) or impossible, if opposite Pawn reached 7(2) line, and King should be active.

Example (one of many tested by me):
[d] 8/6kP/1p4B1/8/2Pp4/8/3K4/r7 b - - 0 1
correct play: 1...Rh1 and next Kg7->f6->e5 e.g. 2.Be4 Rh3 3.Bf5 Rh2+ 4.Kd3 Kf6 5.Be4 Ke5 6.Bg6 Rh3+ 7.Kd2 Kf4 8.Ke2 Rh2+ 9.Kd3 Ke5 -+

Analysis by Stockfish 1.7.1 JA [passed pawns (endgame) =100]:
[...]
1...Rh1 2.Bc2 Rh2+ 3.Kd3 Kxh7 4.Ba4 Rh4 5.Bc6 Kg7 6.Be4 Kf6 7.Kxd4 Ke6 8.Kd3 Ke5 9.Bc6 Rh3+ 10.Kd2 Rg3 11.Ke2 Rc3 12.Bd5 Kd4
-+ (-3.15) Depth: 31 00:02:13 46211kN
1...Rh1 2.Be4 Rh3 3.Bf5 Rh2+ 4.Kd3 Kf6 5.Be4 Ke5 6.Bg6 Rh3+ 7.Ke2 Kf4 8.Kd2 Rh2+ 9.Kd3 Ke5 10.Bf5 Kxf5

Analysis by Stockfish 1.7.1 JA [passed pawns (endgame) =0; Hash=clear]:
[...]
1...Rh1 2.Bc2 Rh3 3.Be4 Kf6 4.Ke2 Ke5 5.Bd3 Kf4 6.Bg6 Rh2+ 7.Kd3 Ke5
-+ (-3.11) Depth: 12 00:00:01 69kN
1...Rh1 2.Be4 Rh3 3.Bc2 Kf6 4.Ke2 Ke5 5.Bd3 Kf4 6.Bg6 Rh2+ 7.Kd3 Ke5
-+ (-3.19) Depth: 12 00:00:01 74kN
Your first test position from the beginning of this thread was better since there Stockfish does not even find a winning line with search in case of default settings - assuming the analysis of the winning plan you have shown is correct, which I did not check in detail. In the new position above, SF needs roughly 2 seconds on your system to find Rh1 followed by king activation. So in this new case, as you mentioned, a possible improvement that helps to evaluate the position with active king correctly would "only" affect the search time but not the result.

I agree to your opinion that there may be some room for improvement of the passed pawns evaluation of SF, and I had already described in detail what I believe is the root cause of that behaviour. Currently we'll have to accept that the SF team considers this as a case too special for adding more code, which I can fully understand although I have a different opinion.

Please note again, however, that you are probably still misinterpreting the meaning of the UCI parameter "Passed pawns (endgame)" that you have been playing with. It is not an absolute bonus but a weight, which can make a huge difference. See my first reply in this thread. Setting that weight to 0 is of course *not* a valid option for the general case, since that would nearly disable all passed pawn evaluations in all endgames.

Sven
It regards mainly (only ?) Pawns on 7 (2) rank.
The difference is 2 minutes !!! (not seconds :wink: ). I hope your code can improve it. :D I will check it!
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Passed Pawns (endgame)

Post by Sven »

lech wrote:It regards mainly (only ?) Pawns on 7 (2) rank.
That could be explained by the way SF calculates the bonus for king proximity which seems to be about doubled for 7th compared to 6th rank.
lech wrote:The difference is 2 minutes !!! (not seconds :wink: ).
Oops ... that is indeed a lot more than my eyes wanted me to see ...
lech wrote:I hope your code can improve it. :D I will check it!
The code that I posted does *not* address this problem (so testing it should not result in *any* difference), it was only an attempt of restructuring the current passed pawn eval code into smaller functions. But Marco does not like it this way, and I have no problem to accept that for now. I have not investigated yet into any modification based on the original code structure since I'm waiting for Marco to possibly come up with his own final cleanup proposal, until now there were some open points. No need to hurry here, of course.

Sven
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Passed Pawns (endgame)

Post by Sven »

Sven Schüle wrote:
lech wrote:I hope your code can improve it. :D I will check it!
The code that I posted does *not* address this problem (so testing it should not result in *any* difference), it was only an attempt of restructuring the current passed pawn eval code into smaller functions. But Marco does not like it this way, and I have no problem to accept that for now. I have not investigated yet into any modification based on the original code structure since I'm waiting for Marco to possibly come up with his own final cleanup proposal, until now there were some open points. No need to hurry here, of course.
The following is addressed not only to you, Marek, but also to the SF team and maybe also Ralph.

A possible test that can be done right now could be to completely remove (comment out) the "king proximity" evaluation for the defending king from the original SF 1.7.1 version, which is in line 906 of evaluate.cpp.

Code: Select all

ebonus += Value&#40;square_distance&#40;theirKingSq, blockSq&#41; * 6 * tr&#41;;
(Btw, the comment in line 899 should be moved right above current line 904.) This would indicate whether my assumption is correct that defending king proximity calculation affects behaviour in your test position(s). Of course: without zeroing the UCI weight.

Then, as a second step (possibly independent from the first), it could be tested whether removing this defending king proximity makes SF play stronger or weaker in general, not related to your special positions.

Sven