# Computer Chess Club Archives

## Messages

### Subject: Re: Question about static exchange evaluation

Author: Bruce Moreland

Date: 12:45:39 11/12/98

Go up one level in this thread

```
On November 12, 1998 at 12:13:26, Larry Coon wrote:

>(Long question follows -- sorry.)
>
>I know I saw SEE talked about recently, but I couldn't
>locate the discussion here, on rgcc or anybody's web
>page (I don't remember where I saw it).  Can somebody
>
>1kq5/3n2p1/5p2/8/6N1/5R2/5RK1 w
>
>Would a SEE do the following?
>  1. Find all attackers on the square in question (f5).
>  2. For each side, order the attackers in value, lowest
>     to highest.  Include the piece that is initially
>     captured to start off the exchange.  Put them into
>     two....whatever, I'll say stacks just to make it
>     easy to talk about.  The lowest valued pieces will
>     be at the top of the stack.  Only the values of the
>     pieces need to be pushed onto the stack.

The trade balance starts out non-zero, you throw in the value of the piece

>  4. Pop the next value for the side NOT to move (black's
>     stack if it's white's move) and SUBTRACT it from
>     the trade balance, then do the same for the other
>     stack.  (This works because at least in my program
>     opposing pieces have opposite signs).
>  5. When all values have been popped off either one of
>     the stacks, then the exchange is over and the trade
>     balance lets you know where you stand.
>  6. However, neither side has to follow the exchange
>     through to its completion.  So if either of the
>     following happen:
>         a. You pop the next value of "your" stack and
>            subtract it from the trade balance and it ends
>            up negative (for white, positive for black)
>         b. You do the same for the opponent's stack and
>            the result is positive (if black is the
>            opponent, otherwise negative)
>     Then you can assume that the side to move will not
>     continue the exchange, exit the loop now, and the
>     current trade balance will be the final balance.

This is hard to understand (I haven't finished my first can of cola yet today)
but it sounds right if what you are doing is exiting at the point where you
prove you can win at least some material by initiating this exchange.

A couple other issues are being accurate about how much you are winning.  For
instance, if your first move is NxR, you can return +2 at this point, assuming
that the knight will be taken, or you can continue and execute QxN QxQ,
determine that QxQ would not be played because QxQ makes this +11, and return +5
instead (of course you proceed to discuss this later in this post).

Another thing is that if you have PxP PxP RxN PxR, you could stop after the
second PxP and return an even exchange, so you need to remember that you could
have done this, rather than returning that this was a losing exchange.

I don't know.  You can do it however you want as long as you avoid bugs and the
amount of time you spend on it is worth it.

>So in my example position, the stacks would look like
>(top of stack to the left):
>   white:  3,  5,  5
>   black: -1, -1, -3, -9
>
>And the process would be as follows:
>   Step   stack   value   balance
>   ----   -----   -----   -------
>     0                       0
>     1      b      -1        1
>     2      w       3       -2
>     3      b      -1       -1  *
>     4      w       5       -6  **
>     5      b      -3       -3
>     6      w       5       -8
>     7      b      -9        1
>
>So at the point I marked *, the value is negative
>with black to move and the loop can actually stop
>here.  Black doesn't have to play NxR, and he's
>won the exchange.  Therefore, the initial capture
>
>However, if black DOES play NxR the following move
>takes him to an even better position (**).  Maybe
>I keep track of "most positive after an odd-numbered
>step" and "most negative after an even numbered
>step"?  Then the "most negative" would be the
>assumed jumping-out point for black, and the "most
>positive" would be the jumping-out point for white.

It might not matter.  NxR is a good idea regardless of whether you win the
exchange or win a rook.  You might need more accuracy if you are disallowing a
+2 exchange if you have already down by 3 or 4, but you can catch this, kind of,
by saying, hey, that's potentially +5, so let's allow it even if it really
evaluated as +2.  You just have to look at the value of the first piece you're
going to take if you're trying to do this kind of fancy and dangerous pruning,
so you know whether it might be worth it to take it, and once you know that it
wins something you can still try it, even though it might not win enough.

All of this is a fake anyway, since it doesn't take into account the tactical
situation over the whole board, but if it did you may as well just use search.

>Or is it like beta-cutoff in alpha-beta where you
>don't care how big the cutoff is, as long as you
>find -a- cutoff?  So in this case, it doesn't
>matter if the next exchange takes black from -1 to
>-6, because the -1 by itself means the initial
>
>I think I'm missing something obvious here about
>the essence of this problem.  Can anybody help?

You're missing having tried it several different ways and determined which is
best for you.  I think you understand the whole problem, you need to figure out
how much of the problem you need to solve for best results.

bruce

>Thanks,
>
>Larry Coon

```