# Computer Chess Club Archives

## Messages

### Subject: Re: Static Exchange Eval (SEE)

Author: JW de Kort

Date: 06:20:15 07/11/01

Go up one level in this thread

```On July 10, 2001 at 07:44:50, Leen Ammeraal wrote:

>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/

Dear mr Ammeraal,

Could you plese give some explaination regarding this sources. e.g how do you
fill the att[] en def[] arrays?

Bedankt!

Jan Willem de Kort

```