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

Passed Pawns (endgame)

Post by lech »

The bonus "Passed Pawns (endgame)" is very questionable for me.
I found the following example.
[d] 8/Pk6/8/8/5P2/4Bq2/5P2/5K2 b - - 0 1
Stockfish 1.7.1 with value “0” can quickly find the correct way 1…Kc7.
With value “100”, even if it is a better (next) position, Stockfish plays 1…Kd7 and King goes to white Pa7. A total flop. :x
[d] 8/P7/4k3/8/5P2/4Bq2/5P2/5K2 b - - 0 1
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

My suggestion: This option may be: „possibility to get passed pawn (endgame)” (default 100), but when such a pawn already exists, not to add any bonus.
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: Passed Pawns (endgame)

Post by Greg Strong »

lech wrote:My suggestion: This option may be: „possibility to get passed pawn (endgame)” (default 100), but when such a pawn already exists, not to add any bonus.
Wouldn't that lead the program to get a pawn to a place where it can become a passed pawn, but then go out of its way never to actually become a passed pawn? 'Cause that would be bad.
Vinvin
Posts: 5228
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Passed Pawns (endgame)

Post by Vinvin »

lech wrote:The bonus "Passed Pawns (endgame)" is very questionable for me.
I found the following example.
Isn't this endgame draw whatever move black plays ?
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

The both positions are “probably :wink: ” won for black, but it is not easy. However, the default value of “passed pawns (endgame)” should remain “100”. :oops:
I tested same positions with possibilities to get a passed pawn in endgame. I used SF 1.7.1 and Fire 1.2.
Fire seems to be more careful than SF, thus my suggestion to add a bonus for “possibility to get passed pawn (endgame)”. :D
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:My suggestion: This option may be: „possibility to get passed pawn (endgame)” (default 100), but when such a pawn already exists, not to add any bonus.
This is a weight parameter, not a bonus. It determines how important all evaluation details related to passed pawns will be for the overall evaluation when you are in endgame, or close to it. Setting it to 0 results in nearly ignoring all passed pawn related evaluation details, where the "amount of ignorance" depends on the exact game phase, i.e "how empty is the board".

What you suggest sounds like something completely different from the meaning of the existing "Passed Pawns (Endgame)" UCI parameter since it would imply to add some more or less complex logic to the program. I cannot comment on this currently, maybe the SF team wants to.

Regarding the given endgame position, I think the problem you point out might also be related to SF evaluation of "king proximity" to passed pawns. After looking into the source I get the impresssion that in the given example, SF does not account for the fact that the black queen can control the promotion square a8 so that the king is able to approach the white king, instead of being forced to approach Pa7. It seems that the Pa7 internally gets a very high bonus for "enemy king proximity" if the black king is not on a8 or b7. Setting the weight to 0 reduces the influence of the king proximity evaluation, which would explain the behaviour you have observed. So I could imagine that there is some relation to it.

Maybe here is some potential for a slight improvement of SF. Setting the UCI weight to 0 seems counterintuitive at least to address that problem :-)

@Marco, Tord, Joona: could you comment on this? Do you think it could be worth considering a change that makes the "king proximity to passed pawns" (evaluate.cpp, lines 900+) evaluation more dependent on whether the enemy of the passed pawn owner has other pieces that can control the passer? At least a queen is able to do both, control a passer *and* create threats against the king, while a king itself usually can't serve for both at the same time.

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 »

Vinvin wrote:
lech wrote:The bonus "Passed Pawns (endgame)" is very questionable for me.
I found the following example.
Isn't this endgame draw whatever move black plays ?
It is possible to move the black king to e4 after placing the queen on a square like d5/c6/b7. I am not sure yet which of these squares is best for the queen. The next step would be to create a zugzwang in order to capture Pf4 first. If this were possible then the next step could be to approach the white king with the black king and try to chase him away from the bishop and Pf2. Mate threats with queen + king could help to win another pawn, everything else would be easy now.

The question remains, would the first step be possible (zugzwang to win Pf4)? I have not figured it out yet, maybe someone else has an idea.

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

Re: Passed Pawns (endgame)

Post by zamar »

Sven Schüle wrote: @Marco, Tord, Joona: could you comment on this? Do you think it could be worth considering a change that makes the "king proximity to passed pawns" (evaluate.cpp, lines 900+) evaluation more dependent on whether the enemy of the passed pawn owner has other pieces that can control the passer? At least a queen is able to do both, control a passer *and* create threats against the king, while a king itself usually can't serve for both at the same time.

Sven
Changes like this often make codebase more complicated with almost no gain. I'd much rather look for ways to simplify SF's passed pawn evaluation code than make it more messy.

One should almost never consider changing code because of one test position :)
Joona Kiiski
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 »

zamar wrote:
Sven Schüle wrote: @Marco, Tord, Joona: could you comment on this? Do you think it could be worth considering a change that makes the "king proximity to passed pawns" (evaluate.cpp, lines 900+) evaluation more dependent on whether the enemy of the passed pawn owner has other pieces that can control the passer? At least a queen is able to do both, control a passer *and* create threats against the king, while a king itself usually can't serve for both at the same time.

Sven
Changes like this often make codebase more complicated with almost no gain. I'd much rather look for ways to simplify SF's passed pawn evaluation code than make it more messy.

One should almost never consider changing code because of one test position :)
Agreed in general. But the issue described above affects essentially *all* positions where one side has a passed pawn advanced very far (e.g. to 7th rank) and the opponent still has a queen that can control the pawn and create threats. It is not just one test position. I consider the existing solution to be too specialized, it seems to be applicable to pawn endings or maybe also to endings with knights and/or bishops. As soon as the opponent of the passed pawn owner has a queen he is not always forced to keep an eye to the passer with his own king, so a great king-pawn distance does not justify a huge bonus (it can be a >100 bonus in case of a 7th rank passer, if you take a look into the source).

But maybe Tord can explain it, or tell me what I am missing here?

Sven
Ralph Stoesser
Posts: 408
Joined: Sat Mar 06, 2010 9:28 am

Re: Passed Pawns (endgame)

Post by Ralph Stoesser »

zamar wrote:
Sven Schüle wrote: @Marco, Tord, Joona: could you comment on this? Do you think it could be worth considering a change that makes the "king proximity to passed pawns" (evaluate.cpp, lines 900+) evaluation more dependent on whether the enemy of the passed pawn owner has other pieces that can control the passer? At least a queen is able to do both, control a passer *and* create threats against the king, while a king itself usually can't serve for both at the same time.

Sven
Changes like this often make codebase more complicated with almost no gain. I'd much rather look for ways to simplify SF's passed pawn evaluation code than make it more messy.

One should almost never consider changing code because of one test position :)
Some evaluation terms are complex in the code, because the matter itself is a complex one. Passed pawns and particularly king safety are rather complex issues, so one would expect that the evaluation of such terms should have a sort of minimal complexity also.

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.