Static exchange evaluation with promotion

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
Desperado
Posts: 829
Joined: Mon Dec 15, 2008 10:45 am

Re: Static exchange evaluation with promotion

Post by Desperado » Mon Jul 26, 2021 5:20 pm

gflohr wrote:
Fri Jul 23, 2021 8:58 pm
Hi!

Trying to understand chess engine programming just for fun ...

... I have used test positions from https://github.com/jdart1/arasan-chess/ ... c/unit.cpp for testing my implementation of a static exchange evaluation function. I have problems understanding this position with white moving Rxc8:

[d] 2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - - 0 1


My implementation returns a bishop's value but the test from Arasan expects a rook's value gain. Unless I terribly missed something here, my explanation is that Arasan "thinks" that re-hitting the rook with Bxc8 is a bad capture, presumably because it would result in a huge material gain for white by re-hitting with the pawn and promoting it to a queen.

My SEE implementation is based on the well-known code from https://www.chessprogramming.org/SEE_-_ ... _Algorithm. Even if I take the material gain by the promotion into account, I still end up with one bishop gain, essentially because the last hit is always the "speculative store" that gets ignored altogether, so that it doesn't matter what else the final pawn hit may win.

So what would be the correct static exchange evaluation for Rxc8 in this position with taking promotions into account?
Hi.

The sequence is like that, if the white rook move (Rc8) is the move in question: Rc8 (+500) Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100
when the material values are like 900,500,300,300,100 / Q,R,B,N,P

If the squence is within the SEE logic, Rc8 is not the next move but because of lva ordering, the pawn capture would be the first one.
Then the sequence would be like: Pc8 (+500 + 900 - 100) Bc8 ( -900 ) Rc8 (+300) = 700

You should also consider for the general case, that when the promotion is the initial move, a negative SEE value will never be less than -100,
so the SEE score is not the promoted score but the pawn value.

Harald
Posts: 301
Joined: Thu Mar 09, 2006 12:07 am

Re: Static exchange evaluation with promotion

Post by Harald » Mon Jul 26, 2021 8:50 pm

The sequence is like that, if the white rook move (Rc8) is the move in question: Rc8 (+500) Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100
when the material values are like 900,500,300,300,100 / Q,R,B,N,P
In this case the value is: Rc8 (+500) = 500 because in ... Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100 Bc8 is a bad black move, even in SEE.
White must not assume that black plays the silly Bc8. A SEE algorithm must solve these combinations and shortcuts correctly.
And Rc8, any other move, Pb8 is not part of SEE on c8.
If the squence is within the SEE logic, Rc8 is not the next move but because of lva ordering, the pawn capture would be the first one.
Then the sequence would be like: Pc8 (+500 + 900 - 100) Bc8 ( -900 ) Rc8 (+300) = 700
In this case Bc8 is good for black. Not playing Bc8 would result in +1300 for white. White can really gain only +700 cp.

User avatar
Desperado
Posts: 829
Joined: Mon Dec 15, 2008 10:45 am

Re: Static exchange evaluation with promotion

Post by Desperado » Mon Jul 26, 2021 11:08 pm

Harald wrote:
Mon Jul 26, 2021 8:50 pm
The sequence is like that, if the white rook move (Rc8) is the move in question: Rc8 (+500) Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100
when the material values are like 900,500,300,300,100 / Q,R,B,N,P
In this case the value is: Rc8 (+500) = 500 because in ... Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100 Bc8 is a bad black move, even in SEE.
White must not assume that black plays the silly Bc8. A SEE algorithm must solve these combinations and shortcuts correctly.
And Rc8, any other move, Pb8 is not part of SEE on c8.
If the squence is within the SEE logic, Rc8 is not the next move but because of lva ordering, the pawn capture would be the first one.
Then the sequence would be like: Pc8 (+500 + 900 - 100) Bc8 ( -900 ) Rc8 (+300) = 700
In this case Bc8 is good for black. Not playing Bc8 would result in +1300 for white. White can really gain only +700 cp.
Last edited by Desperado on Mon Jul 26, 2021 11:20 pm, edited 1 time in total.

User avatar
Desperado
Posts: 829
Joined: Mon Dec 15, 2008 10:45 am

Re: Static exchange evaluation with promotion

Post by Desperado » Mon Jul 26, 2021 11:09 pm

Desperado wrote:
Mon Jul 26, 2021 11:08 pm
Harald wrote:
Mon Jul 26, 2021 8:50 pm
The sequence is like that, if the white rook move (Rc8) is the move in question: Rc8 (+500) Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100
when the material values are like 900,500,300,300,100 / Q,R,B,N,P
In this case the value is: Rc8 (+500) = 500 because in ... Bc8 (-500) Pc8 (+300 + 900 - 100) = 1100 Bc8 is a bad black move, even in SEE.
White must not assume that black plays the silly Bc8. A SEE algorithm must solve these combinations and shortcuts correctly.
And Rc8, any other move, Pb8 is not part of SEE on c8.
If the squence is within the SEE logic, Rc8 is not the next move but because of lva ordering, the pawn capture would be the first one.
Then the sequence would be like: Pc8 (+500 + 900 - 100) Bc8 ( -900 ) Rc8 (+300) = 700
In this case Bc8 is good for black. Not playing Bc8 would result in +1300 for white. White can really gain only +700 cp.
Hello Harald.

I was not talking of the final gains, but about the values of the sequence that are generated.
The sequence that is generated before the negamax algorithm will do its job.

So the first sequence is still [500][-500][+300+900-100]. Then the negamax starts with 1100 ... ends with 500.

The second sequence is [500+900-100][-900][300]. Then the negamax starts with 700 ... ends with 700

Both sequences would be generated in SEE for sure because of the lva-mvv capture. (silly or not).
The special point is, that the same sequence on a non promotion square would result in BxR even in the first sequence.

Finally i only wanted to point out that RxR will only be checked if it is the initial move, that is tested.
Otherwise it would be a wrong solution because the pawn capture (promotion) must be done before (lva order).

Post Reply