# Computer Chess Club Archives

## Messages

### Subject: Re: Static Exchange Eval

Author: Robert Hyatt

Date: 16:07:03 08/02/01

Go up one level in this thread

```On August 02, 2001 at 18:51:31, Artem Pyatakov wrote:

>I am writing my SEE function right now, but I can't seem to fit it into my head
>when the "piece captures/exchanges" are supposed to stop...
>
>I looked at Crafty's Swap code but I am not completely sure how it works... :-(
>
>First I thought that the exchange is supposed to stop when the <value of piece
>Capturing> is greater than <value of piece Being captured>, but I don't think
>this works for some cases.
>
>I also tried doing this: carry out the exchange to the end, at each point
>recording the difference between <my total captures>-<my opponent total
>captures> and then have the opponent search for a MIN in this, and then find a
>MAX before this MIN... This is a bit ugly, and I am not sure if this is correct.
>
>In other words, I am thoroughly confused.
>
>Could somebody please explain to me in words when the capturing is supposed to
>stop? I appreciate it.
>
>Artem Pyatakov

Try this:

play all the captures out.  Then look at the _final_ score and ask "If it was
my move on the last ply, would I have made that capture or not?"  The likely
answer is yes since that was the last capture.  Then you back up to the previous
ply and ask "OK, now it is my move here, would I choose to not capture anything
or would I play the indicated capture?"  Keep doing this until you get back to
the front.

An example:

RxR RxR QxR BxQ

at the end, the material score is +4 for the side after playhing BxQ.  He
would play that capture since if he chooses not to, the score is -5 instead.

Back up one ply.  The score we got backed up says that if we play QxR, we will
get a -4 from our point of view here since if we capture, our opponent will
definitely recapture to get to +4.  If we don't capture, the score is 0.0

Since 0.00 is better than -4, we choose to not play QxR and back that score
up.  Repeat until we get to the front.

I call this "minimaxing" a unary tree, since there are no branches at all,
just a series of captures.

```