Code: Select all
int see(int square, int side)
{
value = 0;
piece = get_smallest_attacker(square, side);
/* skip if the square isn't attacked anymore by this side */
if ( piece )
{
make_capture(piece, square);
/* Do not consider captures if they lose material, therefor max zero */
value = max (0, piece_just_captured() -see(square, other(side)) );
undo_capture(piece, square);
}
return value;
}
Following this method, I only get SEE values >=0, so I can't discriminate between bad and equal captures (both get a 0). The question is, how can I get negative values for bad captures?.