Author: Robert Hyatt
Date: 09:48:40 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.
>
>For problem 2, how would you integrate x-ray and pinned in?
>
>Happy Hacking,
>
>Stuart
Minmax it. Make all captures to there are no more. Then start backing up one
ply at a time asking the question "is the backed up score at this point better
if I just stop and accept the current material balance, or is it better if I
make the next capture?
You have to do that back-to-front to make it work. And then you get the right
answer every time, whether it is best to stand pat or make another capture.
Crafty's "swap.c" has code that does this that is pretty easy to understand.
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.