1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 17:19:36 +00:00

Small simplication of see_ge()

Two simplifications:

- Remove the initialisation to 0 of occupied, which is now unnecessary.
- Remove the initial check for nextVictim == KING

If nextVictim == KING, then PieceValue[MG][nextVictim] will be 0, so that
balance >= threshold is true. So see_ge() returns true anyway.

No functional change.
This commit is contained in:
syzygy 2017-09-03 22:02:49 +02:00 committed by Marco Costalba
parent 04eb87fd08
commit 741523eda8

View file

@ -1004,21 +1004,17 @@ bool Position::see_ge(Move m, Value threshold) const {
Bitboard occupied, stmAttackers; Bitboard occupied, stmAttackers;
balance = PieceValue[MG][piece_on(to)]; balance = PieceValue[MG][piece_on(to)];
occupied = 0;
if (balance < threshold) if (balance < threshold)
return false; return false;
if (nextVictim == KING)
return true;
balance -= PieceValue[MG][nextVictim]; balance -= PieceValue[MG][nextVictim];
if (balance >= threshold) if (balance >= threshold) // Always true if nextVictim == KING
return true; return true;
bool relativeStm = true; // True if the opponent is to move bool relativeStm = true; // True if the opponent is to move
occupied ^= pieces() ^ from ^ to; occupied = pieces() ^ from ^ to;
// Find all attackers to the destination square, with the moving piece removed, // Find all attackers to the destination square, with the moving piece removed,
// but possibly an X-ray attacker added behind it. // but possibly an X-ray attacker added behind it.