mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Micro-optimize king evaluation
Reuse already calculated value, instead of calling king_safety() again. Patch suggested by Balint Pfliegel. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
2aac860db3
commit
e8d89ca5b0
1 changed files with 1 additions and 1 deletions
|
@ -775,7 +775,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
|
||||||
attackUnits = std::min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
|
attackUnits = std::min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2)
|
||||||
+ 3 * (ei.kingAdjacentZoneAttacksCount[Them] + popcount<Max15>(undefended))
|
+ 3 * (ei.kingAdjacentZoneAttacksCount[Them] + popcount<Max15>(undefended))
|
||||||
+ InitKingDanger[relative_square(Us, ksq)]
|
+ InitKingDanger[relative_square(Us, ksq)]
|
||||||
- mg_value(ei.pi->king_safety<Us>(pos, ksq)) / 32;
|
- mg_value(score) / 32;
|
||||||
|
|
||||||
// Analyse enemy's safe queen contact checks. First find undefended
|
// Analyse enemy's safe queen contact checks. First find undefended
|
||||||
// squares around the king attacked by enemy queen...
|
// squares around the king attacked by enemy queen...
|
||||||
|
|
Loading…
Add table
Reference in a new issue