An unstoppable passed pawn

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: An unstoppable passed pawn

Post by lech »

zamar wrote:
lech wrote: Is it possible to make a short (depth seems to be easy to set) search in search (sub-tree) to avoid such surprises? I can’t see another way.
Of course, they are called extensions ;) However I believe that the true problem here is the null move. We could try to disable null move in chaotic positions like this. Unfortunately these kind of positions are so rear that meaning for strength must be zero and fixing this can only make program weaker... so we are not going to do it :(
Can SF get such a simple next position to evaluate on the last depth? I wish it were no. :shock:
[d] 8/8/8/2K5/8/P5p1/6P1/5k2 w - -
A consequence of bad choice, based on this evaluation, can be impossible to undo later.
Such positions can be much more.
Extensions could be used in many other positions e.g. pawns endgames after exchanging pieces (do it?) :)
Uri Blass
Posts: 10300
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: An unstoppable passed pawn

Post by Uri Blass »

I think that it is impossible to extend every unclear position in the search.

The problem is that you may get a tree explosion in unimportant lines.
The solutions is simply to evaluate position like that correctly.

Stockfish gives the line
1.a4 Kxg2 with evaluation of 4.28 pawns for white and I think that the evaluation needs to be clearly closer to draw because stockfish cannot know if white is winning or black is winning.

Uri
zamar
Posts: 613
Joined: Sun Jan 18, 2009 7:03 am

Re: An unstoppable passed pawn

Post by zamar »

Uri Blass wrote: 1)you are sure that the opponent king cannot stop it
2)you are sure that the opponent cannot promote earlier(or at the same time).
3)you are sure that the opponent cannot mare earlier(I guess that 3 is less important but I composed a diagram to show that it can happen)
3) is so rear that we can easily ignore it, but now I'm beginning to see that we definetily need to change our unstoppable pawn scoring. Now I understand why I've seen very wrong scores in some pawn endgames with racing pawns.
Joona Kiiski
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: An unstoppable passed pawn

Post by lech »

zamar wrote: 3) is so rear that we can easily ignore it, but now I'm beginning to see that we definetily need to change our unstoppable pawn scoring. Now I understand why I've seen very wrong scores in some pawn endgames with racing pawns.
:lol: A big bonus for unstoppable passed pawns is a credit for the further speculated dynamic events. It is no good to end a search on such positions. Extensions would be similar to our thinking, but ..
Assert(I can help to improve Stockfish) :lol: :lol: :lol:
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: An unstoppable passed pawn

Post by bob »

zamar wrote:
bob wrote: Do you mean "protected passed pawn" as opposed to "unstoppable"???
No, this is the problematic position near the leaves.

[d] 5N2/8/6p1/7p/1pP5/4p1P1/k6P/3K4 w - -

Because of terrible static misevaluation (+7 or sth like that), stockfish never reaches a position where black promotes. Huge misevaluation makes possible that in search white can make even two null moves here and still thinking it's winning.

Even if black's pawn was in b2, Stockfish's dummy evaluation calculates that white is a piece up and white has an unstoppable passed pawn. Black's two passed pawns are not able to reduce the advantage enough.

Of course human easily spots that black's pawn in b4/b3/b2 is unstoppable and promotes with check but because white has a knight Stockfish's algorithm doesn't recognize this.

Do you have some code in crafty to recognize these kind of positions?[/quote

Not with a piece left, although it is actually doable in the case of a knight (or perhaps a bishop.

Q1: how many moves to promote? In this case just 2 because of the check.

Q2: how many moves to get your piece to a square where it attacks a square in front of the pawn? In the case of the knight, this is way too long in this position. A bishop is somewhat simpler but blocked rays are important.

I might look at this, in fact...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: An unstoppable passed pawn

Post by bob »

Uri Blass wrote:
zamar wrote:
bob wrote: Do you mean "protected passed pawn" as opposed to "unstoppable"???
No, this is the problematic position near the leaves.

[d] 5N2/8/6p1/7p/1pP5/4p1P1/k6P/3K4 w - -

Because of terrible static misevaluation (+7 or sth like that), stockfish never reaches a position where black promotes. Huge misevaluation makes possible that in search white can make even two null moves here and still thinking it's winning.

Even if black's pawn was in b2, Stockfish's dummy evaluation calculates that white is a piece up and white has an unstoppable passed pawn. Black's two passed pawns are not able to reduce the advantage enough.

Of course human easily spots that black's pawn in b4/b3/b2 is unstoppable and promotes with check but because white has a knight Stockfish's algorithm doesn't recognize this.

Do you have some code in crafty to recognize these kind of positions?
I wonder if you tried to change the definition of unstoppable pawn to be more narrow.

unstoppable passed pawn should be defined as a pawn the following conditions happen:

1)you are sure that the opponent king cannot stop it
2)you are sure that the opponent cannot promote earlier(or at the same time).
3)you are sure that the opponent cannot mare earlier(I guess that 3 is less important but I composed a diagram to show that it can happen)

[D]k7/P7/K7/6p1/8/8/1P6/8 w - - 0 1

It seems that the second part is missing from the definition of stockfish(otherwise it could avoid giving a big bonus for the white pawn)

Even without the knight stockfish evaluates the position wrong and does not see that black is winning.

[D]8/8/6p1/7p/1pP5/4p1P1/k6P/3K4 w - - 0 8

I think that it may be better to avoid pruning in positions when
only condition 1 is true and condition 2 is false(and you also may want to have evaluation that is closer to draw because of uncertainty).

Uri
Crafty has always handled those cases, and even back in the late 70's blitz/cray-blitz understood "square of the king". But having a piece, particularly a knight, can be extremely problematic in that the search can't recognize what is happening quickly enough, and the eval is happy because it assumes any piece can stop a pawn from running. In the case of a knight, it can barely stop anything.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: An unstoppable passed pawn

Post by bob »

lech wrote:
zamar wrote: 3) is so rear that we can easily ignore it, but now I'm beginning to see that we definetily need to change our unstoppable pawn scoring. Now I understand why I've seen very wrong scores in some pawn endgames with racing pawns.
:lol: A big bonus for unstoppable passed pawns is a credit for the further speculated dynamic events. It is no good to end a search on such positions. Extensions would be similar to our thinking, but ..
Assert(I can help to improve Stockfish) :lol: :lol: :lol:
There are some things you can't reasonably expect search to resolve. As a human I ask "does my opponent have anything that can prevent this pawn from queening? This includes square of the king rule for K+P only endings, if there is a piece left, I only consider if it can attack a square in front of the pawn before the pawn gets there. If we both have a piece it gets more complex in that if I can attack a square my opponent's piece needs to reach a cutoff point, it can't get there. A good idea would probably be hybrid, some sort of "uncertainty" score that can drive the search a bit deeper without blowing up the tree, and some sort of approximation to the score so that the eval can take over as things become slightly clearer.

It is not that easy, trust me...
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: An unstoppable passed pawn

Post by bob »

lech wrote:
zamar wrote:
lech wrote: Is it possible to make a short (depth seems to be easy to set) search in search (sub-tree) to avoid such surprises? I can’t see another way.
Of course, they are called extensions ;) However I believe that the true problem here is the null move. We could try to disable null move in chaotic positions like this. Unfortunately these kind of positions are so rear that meaning for strength must be zero and fixing this can only make program weaker... so we are not going to do it :(
Can SF get such a simple next position to evaluate on the last depth? I wish it were no. :shock:
[d]8/8/8/2K5/8/P5p1/6P1/5k2 w - -
A consequence of bad choice, based on this evaluation, can be impossible to undo later.
Such positions can be much more.
Extensions could be used in many other positions e.g. pawns endgames after exchanging pieces (do it?) :)
Cray Blitz and older versions of Crafty got this right, but only after the white pawn is captured.. I do not know if the current code will catch that xray check to pick up the a-pawn. It would deal with a black h-pawn since the pawn promotes on h1 and attacks a8 at the same time, and would consider this won unless the black king can get to b8 to defend the new queen.
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: An unstoppable passed pawn

Post by lech »

bob wrote: There are some things you can't reasonably expect search to resolve. As a human I ask "does my opponent have anything that can prevent this pawn from queening? This includes square of the king rule for K+P only endings, if there is a piece left, I only consider if it can attack a square in front of the pawn before the pawn gets there. If we both have a piece it gets more complex in that if I can attack a square my opponent's piece needs to reach a cutoff point, it can't get there. A good idea would probably be hybrid, some sort of "uncertainty" score that can drive the search a bit deeper without blowing up the tree, and some sort of approximation to the score so that the eval can take over as things become slightly clearer.

It is not that easy, trust me...
I trust you. But when I looking trough the code of Stockfish (evaluate passed pawns, pawns), I think that it would be better cut and cut many doubt lines and go deeper, like you wrote. In my opinion, engines should be only stimulated, when I see many orders (high bonuses and penalties). Sometimes I am watching play of Stockfish and think how does it fight with them?
It is only my personal impression, maybe I feel badly. :wink:
Ralph Stoesser
Posts: 408
Joined: Sat Mar 06, 2010 9:28 am

Re: An unstoppable passed pawn

Post by Ralph Stoesser »

bob wrote:
Uri Blass wrote:
zamar wrote:
bob wrote: Do you mean "protected passed pawn" as opposed to "unstoppable"???
No, this is the problematic position near the leaves.

[d] 5N2/8/6p1/7p/1pP5/4p1P1/k6P/3K4 w - -

Because of terrible static misevaluation (+7 or sth like that), stockfish never reaches a position where black promotes. Huge misevaluation makes possible that in search white can make even two null moves here and still thinking it's winning.

Even if black's pawn was in b2, Stockfish's dummy evaluation calculates that white is a piece up and white has an unstoppable passed pawn. Black's two passed pawns are not able to reduce the advantage enough.

Of course human easily spots that black's pawn in b4/b3/b2 is unstoppable and promotes with check but because white has a knight Stockfish's algorithm doesn't recognize this.

Do you have some code in crafty to recognize these kind of positions?
I wonder if you tried to change the definition of unstoppable pawn to be more narrow.

unstoppable passed pawn should be defined as a pawn the following conditions happen:

1)you are sure that the opponent king cannot stop it
2)you are sure that the opponent cannot promote earlier(or at the same time).
3)you are sure that the opponent cannot mare earlier(I guess that 3 is less important but I composed a diagram to show that it can happen)

[D]k7/P7/K7/6p1/8/8/1P6/8 w - - 0 1

It seems that the second part is missing from the definition of stockfish(otherwise it could avoid giving a big bonus for the white pawn)

Even without the knight stockfish evaluates the position wrong and does not see that black is winning.

[D]8/8/6p1/7p/1pP5/4p1P1/k6P/3K4 w - - 0 8

I think that it may be better to avoid pruning in positions when
only condition 1 is true and condition 2 is false(and you also may want to have evaluation that is closer to draw because of uncertainty).

Uri
Crafty has always handled those cases, and even back in the late 70's blitz/cray-blitz understood "square of the king". But having a piece, particularly a knight, can be extremely problematic in that the search can't recognize what is happening quickly enough, and the eval is happy because it assumes any piece can stop a pawn from running. In the case of a knight, it can barely stop anything.
I would say it's a serious issue in SF that there is no detection of passed pawns which are unstoppable because their way to the promotion field is protected while the enemy has only the king to prevent the pawn from promoting. It is easy to implement this rule and not to implement it causes unnecessary problems.

What I do not fully understand is the following. When I implement that "protected passed pawn" rule in SF and analyse the first position given in this thread, SF seem to understand this position better, especially it doesn't want to play the very bad move 2. Ke1 after Blacks move 1. .. Bf8. Although there are pieces besides pawns on board and the critical position, given by Joona, has an enemy knight on the board, the search seem to understand this position clearly better than before, only because I have implemented this simple rule. The ELO gain in implementing this rule seem to be not that large, but I'm sure there is one.