Static Exchange Evaluation

Discussion of chess software programming and technical issues.

Moderator: Ras

arjunbasandrai
Posts: 10
Joined: Thu Oct 26, 2023 8:41 pm
Full name: Arjun Basandrai

Static Exchange Evaluation

Post by arjunbasandrai »

I am trying to implement SEE in my chess engine - "Shuffle" (https://github.com/ArjunBasandrai/shuffle-chess-engine/)

However, I am having a bit of trouble understanding what the algorithm should return.

Assuming that the middlegame material scores are - (P=82, N=337, B=365, R=477, Q=1025, K=12000, p=-82, n=-337, b=-365, r=-477, q=-1025, k=-12000)

In the position (8/R7/5k1P/5p2/p1p2P2/Br1pPK1p/1P1R4/r7 b - -)

What should be the SEE of the move :-
  • b3a3
  • b3b2
My implementation is giving the result for b3a3 as -112 and that for b3b2 as -395. Are these values correct?
From what I have understood the value for b3a3 should be -30 and that b3b2 should be -395 only. Am I right?
User avatar
lithander
Posts: 915
Joined: Sun Dec 27, 2020 2:40 am
Location: Bremen, Germany
Full name: Thomas Jahn

Re: Static Exchange Evaluation

Post by lithander »

I have compiled this little set of test positions for SEE. Some of them I found, some I added myself.
https://github.com/lithander/Leorik/blo ... st/see.epd
Minimal Chess (simple, open source, C#) - Youtube & Github
Leorik (competitive, in active development, C#) - Github & Lichess
arjunbasandrai
Posts: 10
Joined: Thu Oct 26, 2023 8:41 pm
Full name: Arjun Basandrai

Re: Static Exchange Evaluation

Post by arjunbasandrai »

Thanks for providing the test suite!

One more doubt I have is regarding where exactly to use pruning using SEE in q-search and the negamax? Any resources that I can take a look at?
arjunbasandrai
Posts: 10
Joined: Thu Oct 26, 2023 8:41 pm
Full name: Arjun Basandrai

Re: Static Exchange Evaluation

Post by arjunbasandrai »

lithander wrote: Mon Dec 25, 2023 10:29 pm I have compiled this little set of test positions for SEE. Some of them I found, some I added myself.
https://github.com/lithander/Leorik/blo ... st/see.epd
I tested my new implementation on the Arasan Test Suite. That and yours also has a FEN (2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - -) and the SEE value of it is supposed to be the value of a Rook. Should it not be Bishop value?
abulmo2
Posts: 462
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: Static Exchange Evaluation

Post by abulmo2 »

arjunbasandrai wrote: Tue Dec 26, 2023 3:23 pm
lithander wrote: Mon Dec 25, 2023 10:29 pm I have compiled this little set of test positions for SEE. Some of them I found, some I added myself.
https://github.com/lithander/Leorik/blo ... st/see.epd
I tested my new implementation on the Arasan Test Suite. That and yours also has a FEN (2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - -) and the SEE value of it is supposed to be the value of a Rook. Should it not be Bishop value?
[d]2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - - Considering the move c3c8 (or Rxc8), the value can be a bishop if you ignore pawn promotion or a rook if you take into account that the pawn on b7 can promote to a queen. Taking or not into account pawn promotion during a SEE sequence is a mater of taste. On the above position the real value of the exchange is a rook, because the bishop is not suppose to capture to avoid the pawn promotion. But there are cases where considering pawn promotions would be a mistake, or too complicated to implement correctly.
Richard Delorme
arjunbasandrai
Posts: 10
Joined: Thu Oct 26, 2023 8:41 pm
Full name: Arjun Basandrai

Re: Static Exchange Evaluation

Post by arjunbasandrai »

abulmo2 wrote: Tue Dec 26, 2023 7:24 pm
arjunbasandrai wrote: Tue Dec 26, 2023 3:23 pm
lithander wrote: Mon Dec 25, 2023 10:29 pm I have compiled this little set of test positions for SEE. Some of them I found, some I added myself.
https://github.com/lithander/Leorik/blo ... st/see.epd
I tested my new implementation on the Arasan Test Suite. That and yours also has a FEN (2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - -) and the SEE value of it is supposed to be the value of a Rook. Should it not be Bishop value?
[d]2r5/1P4pk/p2p1b1p/5b1n/BB3p2/2R2p2/P1P2P2/4RK2 w - - Considering the move c3c8 (or Rxc8), the value can be a bishop if you ignore pawn promotion or a rook if you take into account that the pawn on b7 can promote to a queen. Taking or not into account pawn promotion during a SEE sequence is a mater of taste. On the above position the real value of the exchange is a rook, because the bishop is not suppose to capture to avoid the pawn promotion. But there are cases where considering pawn promotions would be a mistake, or too complicated to implement correctly.
Thanks for clarifying! That makes much more sense.

I do have one last doubt. Where and how should I use the SEE function for pruning. In negamax should I use it before LMR and after razoring, futility pruning, LMP? What should be the cutoff SEE value to prune a branch?