En passant bonus

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

xmas79
Posts: 286
Joined: Mon Jun 03, 2013 7:05 pm
Location: Italy

Re: En passant bonus

Post by xmas79 »

cdani wrote:
xmas79 wrote:
cdani wrote:...Also a slight improvement:

Code: Select all

c=((a >> 1) & c) | ((a << 1) & c);
Hi Daniel,
don't you need to mask A/H files when shifting left/right?
Not really. There is nothing outside the second rank of c that can be "Anded".
Suppose you have:
- black pawns in a4 and b4
- white pawns in a2 b3 h3

I'm assuming "c" is the bitboard of black's pawn shifted 16-bit downward. If so, c is the bitboard a2 and b2. When you do c >> 1 you will end up having b2 and c2 as bitmask that will be ANDed with "a" (a2 b2 h3), which is OK. When you do c << 1 you will end up having a2 and h3, and then you will AND with the h3 pawn.

Did I miss something?
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: En passant bonus

Post by Lyudmil Tsvetkov »

cdani wrote:No way. It never works on Andscacs. I tested with penalization/bonus of 3, 5 and 10 cp. It's only good at selfplay, but never at gauntlet.

Most probably there is something that interferes in the eval function. May be if at some point I recalculate the eval values again of most things, I will try again.
Thanks for trying, Daniel!
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: En passant bonus

Post by cdani »

xmas79 wrote: Suppose you have:
- black pawns in a4 and b4
- white pawns in a2 b3 h3

I'm assuming "c" is the bitboard of black's pawn shifted 16-bit downward. If so, c is the bitboard a2 and b2. When you do c >> 1 you will end up having b2 and c2 as bitmask that will be ANDed with "a" (a2 b2 h3), which is OK. When you do c << 1 you will end up having a2 and h3, and then you will AND with the h3 pawn.

Did I miss something?
The variables get "anded" by the 2nd and 4th rank, so other pawns in other ranks dissapear of them.
vincenegri
Posts: 73
Joined: Wed Feb 11, 2015 9:19 am

Re: En passant bonus

Post by vincenegri »

Lyudmil Tsvetkov wrote:
lantonov wrote:This idea is already running on Fishtest by Vince Negri with attribution to Lyudmil Tsvetkov and passed STC (short-time control) convincingly.

Doesn't it go for Black too (black pawn on rank 4 and white en-passant pawn on rank 2) ?

Vince implemented a variant of this idea (weaker or stronger, I don't know) with black pawn on rank 5 and white pawn on rank 2.
Thanks to Mr. Negri.

I do not quite understand what rank 4 and rank 5 mean.

From white's point of view, the bonus should be due to any pawn on the 5th rank, with an enemy pawn on the 7th to the left or to the right on adjacent files.

This will hold true for both white and black.

The 7th rank is again seen from white's perspective, so actually the black pawn on the 7th rank from white's point of view is a pawn on the 2nd rank from black's point of view.

I posted quite some diagrams in my original message, you might want to look at them.
The code is misleading - the number 4 is actually the 5th rank, so this is implemented as per the thread starter. The patch in SF also caters for both white and black - this the the relative_rank() call.

I have run an automated tuning run which suggested a bonus very close to your original estimate - so re-testing with that value.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: En passant bonus

Post by Lyudmil Tsvetkov »

vincenegri wrote:
Lyudmil Tsvetkov wrote:
lantonov wrote:This idea is already running on Fishtest by Vince Negri with attribution to Lyudmil Tsvetkov and passed STC (short-time control) convincingly.

Doesn't it go for Black too (black pawn on rank 4 and white en-passant pawn on rank 2) ?

Vince implemented a variant of this idea (weaker or stronger, I don't know) with black pawn on rank 5 and white pawn on rank 2.
Thanks to Mr. Negri.

I do not quite understand what rank 4 and rank 5 mean.

From white's point of view, the bonus should be due to any pawn on the 5th rank, with an enemy pawn on the 7th to the left or to the right on adjacent files.

This will hold true for both white and black.

The 7th rank is again seen from white's perspective, so actually the black pawn on the 7th rank from white's point of view is a pawn on the 2nd rank from black's point of view.

I posted quite some diagrams in my original message, you might want to look at them.
The code is misleading - the number 4 is actually the 5th rank, so this is implemented as per the thread starter. The patch in SF also caters for both white and black - this the the relative_rank() call.

I have run an automated tuning run which suggested a bonus very close to your original estimate - so re-testing with that value.
Thanks a lot, Vince.

I do not understand much of programming, so explaining sometimes helps.

Whatever the outcome of the run, maybe you should also run your first successful patch with the 7;5 values at LTC. You never know what scales and what does not.

If you allow me a personal question: what is your nationality?
With most people I can roughly guess by their names, but with you it is difficult: French, Italian, American?
vincenegri
Posts: 73
Joined: Wed Feb 11, 2015 9:19 am

Re: En passant bonus

Post by vincenegri »

Lyudmil Tsvetkov wrote:
Thanks a lot, Vince.

I do not understand much of programming, so explaining sometimes helps.

Whatever the outcome of the run, maybe you should also run your first successful patch with the 7;5 values at LTC. You never know what scales and what does not.

If you allow me a personal question: what is your nationality?
With most people I can roughly guess by their names, but with you it is difficult: French, Italian, American?
Yes, if the tuned values are not an improvement I will go back to the original guess for LTC.

I am British but of Italian heritage, btw. :)
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: En passant bonus

Post by Lyudmil Tsvetkov »

vincenegri wrote: I am British but of Italian heritage, btw. :)
Gosh...
vincenegri
Posts: 73
Joined: Wed Feb 11, 2015 9:19 am

Re: En passant bonus

Post by vincenegri »

A patch implementing this has passed STC and LTC tests on the Stockfish testing framework. Your guess of a bonus of around 7 cp turned out to be quite accurate. :)
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: En passant bonus

Post by Lyudmil Tsvetkov »

vincenegri wrote:A patch implementing this has passed STC and LTC tests on the Stockfish testing framework. Your guess of a bonus of around 7 cp turned out to be quite accurate. :)
Thanks, Vince.

The merit is entirely yours, you did a great implementation of it.

Still, I am not certain as to the real size of the values: maybe the first patch with lower values would scale better at LTC, no matter that it needed more games at STC, maybe not.
It is also possible that even bigger values would achieve better, who knows?

Anyway, thanks again, the joy of a man who can not push patches himself.:)
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: En passant bonus

Post by Lyudmil Tsvetkov »

Hi Vince,

if you are reading this by chance, here my plea to you.

I see the retested patch struggled a lot, and finally got it to just yellow.

Not that if it succeeds I would like to see it implemented, maybe it does not have sense, but, out of pure curiosity, would it be possible to kindly ask you to run one more attempt at STC/LTC with a bit larger values, 20;10, 20cps for the middlegame and 10cps for the endgame?

SPSA might suggest lower values, but it is not bad to also try our gut feeling, and I think a bit larger values are optimal for SF.

Many thanks in advance, if you happen to read this.