Passed Pawns (endgame)

Discussion of chess software programming and technical issues.

Moderator: Ras

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Passed Pawns (endgame)

Post by mcostalba »

Ralph Stoesser wrote: You don't have to. Only $ELO makes the world go round...
Nevertheless, from a chess player's point of view this is a very stupid behauviour from SF and possibly many other engines.
I'am a very bad chess player :lol:
lech
Posts: 1169
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

mcostalba wrote:
Ralph Stoesser wrote:
All the proposed patch attempts do work well with this position. Except the patches from SF team, because, so far, they haven't shown any. 8-)
I don't have any patch to show, sorry. Actually I am not very interested in tweaking for a given position. I consider good a patch that proves to increase strength in a real games test session: I don't care how it behaves in specific positions. 8-)
Passed pawns are very important factor and need a special code. It seems to be impossible to improve it by a general code. Probably a main difference between engines is: how engine handle with the theme “passed pawns” (excluding that all are clones :lol: ). It is a pity that a possibility to improve engines is rejected. Let engines be “stupid”. :(
lech
Posts: 1169
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

mcostalba wrote: I'am a very bad chess player :lol:
I was watching a game Fire 13 - SF 171 (4 min.+2 sec.). SF had helped Fire to get a side passed pawn (in Bishop endgame! :cry: ) and lost the game. It looked like this (I don’t remember the right side exactly).
[d] 4k3/2p2p1p/3p1bp1/1p1P4/p5P1/2P2P2/PP2K2P/2B5 b - - 0 1
SF moved 1…a3 2.b3 Bxc3 3.Bxa3 and in the next moves Fire by a2->a4 got the side passed pawn. :shock:
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Passed Pawns (endgame)

Post by mcostalba »

lech wrote: SF moved 1…a3 2.b3 Bxc3 3.Bxa3 and in the next moves Fire by a2->a4 got the side passed pawn. :shock:
After the above moves and ..Kd7 is not so obvious that white wins:

[d] 8/2pk1p1p/3p2p1/1p1P4/6P1/BPb2P2/P3K2P/8 w - - 0 3


I have quickly tried some engine, but result is almost draw with just a small advantage for white...
lech
Posts: 1169
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

mcostalba wrote: After the above moves and ..Kd7 is not so obvious that white wins:

[d] 8/2pk1p1p/3p2p1/1p1P4/6P1/BPb2P2/P3K2P/8 w - - 0 3

I have quickly tried some engine, but result is almost draw with just a small advantage for white...
Of course, the way to win is not obvious one. But Fire, thanks to the passed pawn, methodically increased advantage and won. Sorry, I haven’t all the game. I remember only that I tested later this position and Fire proposed 1…Kd7 (P4 3.5G 2hreads). The right side (pawn structure) could be other.
Ralph Stoesser
Posts: 408
Joined: Sat Mar 06, 2010 9:28 am

Re: Passed Pawns (endgame)

Post by Ralph Stoesser »

Why use Max() here? tr can't become negative.
evaluate.cpp, line 892+893

Code: Select all

int r = int(relative_rank(Us, s) - RANK_2);
int tr = Max(0, r * (r - 1));
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Passed Pawns (endgame)

Post by mcostalba »

Ralph Stoesser wrote:Why use Max() here? tr can't become negative.
evaluate.cpp, line 892+893

Code: Select all

int r = int(relative_rank(Us, s) - RANK_2);
int tr = Max(0, r * (r - 1));
Yes, you are right. Thanks Ralph.
User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Passed Pawns (endgame)

Post by Eelco de Groot »

Ralph Stoesser wrote:Why use Max() here? tr can't become negative.
evaluate.cpp, line 892+893

Code: Select all

int r = int(relative_rank(Us, s) - RANK_2);
int tr = Max(0, r * (r - 1));
I don't quite follow, relative_rank(Us, s) can be == RANK_2 if the passed pawn is still on the original rank, in which case r == 0.

What did I miss :)

Not that this code is still in Rainbow Serpent, I wanted to give passed pawns on their original rank also a minimal rank related bonus, so it is changed to

Code: Select all

    while (b)
    {
        Square s = pop_1st_bit(&b);

        assert(pos.piece_on(s) == piece_of_color_and_type(Us, PAWN));
        assert(pos.pawn_is_passed(Us, s));

        int r = int(relative_rank(Us, s) - RANK_2);
        int tr = Max(1, r * (r - 1));
Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
BubbaTough
Posts: 1154
Joined: Fri Jun 23, 2006 5:18 am

Re: Passed Pawns (endgame)

Post by BubbaTough »

Eelco de Groot wrote:
I don't quite follow, relative_rank(Us, s) can be == RANK_2 if the passed pawn is still on the original rank, in which case r == 0.

What did I miss :)
Not quite sure I am following. Are you worrying about the result of 0 * -1 being negative?

-Sam
User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Passed Pawns (endgame)

Post by Eelco de Groot »

BubbaTough wrote:
Eelco de Groot wrote:
I don't quite follow, relative_rank(Us, s) can be == RANK_2 if the passed pawn is still on the original rank, in which case r == 0.

What did I miss :)
Not quite sure I am following. Are you worrying about the result of 0 * -1 being negative?

-Sam
Ah, I see now, I missed that, thanks Sam, but what if a technically illegal position has a passed pawn on the bottom rank, RANK_1. In that case r really is negative and tr for RANK_1 becomes greater than for RANK_2, which is not what you really want. Not that it often would be a problem but in that case the code does not work with Max either, I agree. Maybe r has to be positive at all times that would be better, so something like tr = r * (r-1) + 1 I had been thinking about that because in my version of the code tr == 1 for both RANK_2 and RANK_3 so that is slightly illogical maybe (but bonuses are made from both tr and r * r so there still is enough difference). Not sure it would be better though. And tr for RANK_1 is still greater than RANK_2 then.

Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan