Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Static Exchange Eval

Author: Leen Ammeraal

Date: 19:05:33 08/02/01

Go up one level in this thread


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 value of the
first attacker, 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, where each of these
profits is nonnegative.

So far, I did not succeed in replacing this function
with a faster, nonrecursive one. It would be nice if
someone of this forum did and showed an equivalent
but faster version.

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




This page took 0 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.