# Computer Chess Club Archives

## Messages

### Subject: Static Exchange Eval (SEE)

Author: Leen Ammeraal

Date: 04:44:50 07/10/01

```There was a question about Static Exchange Evaluation
in CCC a short while ago, with reactions from
Bob Hyatt and Bruce Moreland. Strangely enough,
these postings, along with one from myself, seem
to have disappeared, so I send my contribution
once again below.

Here is my function for Static Exchange Evaluation.
==================================================
It is based on the value cur of the current piece
on the board that is first to be captured, and
two tables:

att[nAtt-1], ..., att[0]  values of attackers
def[nDef-1], ..., def[0]  values of defenders

Note the order: att[nAtt-1] is the first attack, etc.
Let's rewrite Hyatt's example RxR RxR QxR BxQ
as follows, to distinguish between the three rooks
involved:

R1xR0 R2xR1 QxR2 BxQ

Then we have:
cur = R0, nAtt = nDef = 2,
att[1] = R1, att[0] = Q
def[1] = R2, def[0] = B
This function returns the value 0 in this case:

// Static Exchange Evaluation:
int gain(int cur, int *att, int nAtt, int *def, int nDef)
{  int retval = 0;
if (nAtt)
{  int profit = cur - gain(att[nAtt-1], def, nDef, att, nAtt-1);
if (profit > 0)
retval = profit;
}
return retval; // Always >= 0
}

Explanation: the profit of capturing a piece is equal
to the value of that piece minus the profit of the
opponent after this capture, except that a profit is
set to zero when this computation gave a negative result.
So far, I did not succeed in replacing this function
with a faster, nonrecursive one. It would be nice if
anyone of this forum did and showed an equivalent
but faster version.

Leen Ammeraal
http://home.wxs.nl/~ammeraal/

```

This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.