Passed Pawns (endgame)

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Passed Pawns (endgame)

Post by Ralph Stoesser »

I also do not understand. Pe4 + Pd4 isn't a chain.
Pawn chain consists of pawns placed on the same diagonal, without interruption, so that only one of them is undefended. That pawn is called a base of pawn chain.
http://chessprogramming.wikispaces.com/Pawn+chain
User avatar
Eelco de Groot
Posts: 4576
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Passed Pawns (endgame)

Post by Eelco de Groot »

Ralph Stoesser wrote:I also do not understand. Pe4 + Pd4 isn't a chain.
Pawn chain consists of pawns placed on the same diagonal, without interruption, so that only one of them is undefended. That pawn is called a base of pawn chain.
http://chessprogramming.wikispaces.com/Pawn+chain
It is for Stockfish though, if I understand it correctly, a pawn on rank_bb(r) is counted as a chained pawn, but the pawn that forms a base of a chain is not counted (for example e3 if there is also a pawn on d4 is a base pawn), you could defend that decision by stating a base pawn is a weak spot so not worth a bonus but it is also a very important pawn for the chain. So I consider that a weak spot in the code right now, the defence of a pawn base is non-existant in the code itself.

Regards, Eelco

Code: Select all

      // Member of a pawn chain (but not the backward one)? We could speed up
      // the test a little by introducing an array of masks indexed by color
      // and square for doing the test, but because everything is hashed,
      // it probably won't make any noticeable difference.
      chain =  ourPawns
             & neighboring_files_bb(f)
             & (rank_bb(r) | rank_bb(r - (Us == WHITE ? 1 : -1)));
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
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Passed Pawns (endgame)

Post by lech »

mcostalba wrote:
mcostalba wrote:
I am very sorry, I really don't understand what are you trying to say.
Perhaps I have understood. Are you suggesting the following patch ?

Code: Select all

       chain =  ourPawns
              & neighboring_files_bb(f)
-             & (rank_bb(r) | rank_bb(r - (Us == WHITE ? 1 : -1)));
+             & (rank_bb(r) | rank_bb(r + 1) | rank_bb(r - 1));
Yes, in common sense.
[d] 8/8/5p2/1p5p/1Pp5/2P2P2/6P1/8 w - - 0 1
the blocked pawns b5, c3 bonus =0
Pg2 – [!(theirPawns & file_bb(f))] - bonus /2 (?)
It was too absorbing work to improve the SF’s code, though an interesting new experience. :D
Good luck!
BTW: My last suggestion is: too high penalty for double isolated (x2) pawns [e.g. if (isolated & !doubled)].