Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: SEE 101

Author: Bas Hamstra

Date: 01:23:43 08/06/04

Go up one level in this thread


On August 06, 2004 at 00:09:52, Stuart Cracraft wrote:

>Assume for the sake of simplicity you aren't worrying about pinned
>or x-rayed pieces for now.
>
>Assume your attackers of sq are in attackers[], your defenders of sq
>are in  defenders[] and the count of each is in at1 and de1 and you
>have them sorted from highest value to lowest value,i.e.
>Rook, Knight, Pawn at positions 0, 1, 2 in attackers[], etc.
>
>Defenders are the defenders of the piece at sq about which
>this whole exchange is taking place.
>
>Do your exchange by lowest piece first. Return a function value
>reflecting the value of the exchange from the attacker's perspective
>and taking into account that the whole sequence doesn't have to play
>out and one can stop mid-way if advantageous to do so.
>
>int see(sq) {
>  int defenders[], attackers[], de1, at1, value;
>  // Value of piece starting the exchange
>  value = absolute value of piece at sq.
>  while (1) {
>    if (de1 > 0) {
>      value -= attacker[at1-1];
>      at1--;
>    } else break;
>    if (at1 > 0) {
>      value += defender[de1-1];
>      de1--;
>    } else break;
>  }
>  return(value)
>}
>
>What do you think should be the modification to the code
>to be able to stand-pat at the right time(s) and return
>a value that is accurate for chess, not checkers-like in
>terms of everything being forced, allowing for standing
>pat and ignoring x-ray and pinned.

Think of it as a miniqsearch, with all captures to 1 square. Either side can
stand pat or improve with a new capture. In fact you can build a verification
routine this way quite easily, to check your SEE routine returns the right
value. You can also take this routine as a basis and then rework it to make it
more efficient (replace recursion by a loop, remove all make/unmakes etc).

Bas.






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.