- // Evaluate space for both sides
- if (ei.mi->space_weight() > 0)
- {
- evaluate_space<WHITE, HasPopCnt>(pos, ei);
- evaluate_space<BLACK, HasPopCnt>(pos, ei);
- }
+ // Evaluate space for both sides
+ if (ei.mi->space_weight() > 0)
+ {
+ int s = evaluate_space<WHITE, HasPopCnt>(pos, ei) - evaluate_space<BLACK, HasPopCnt>(pos, ei);
+ ei.value += apply_weight(make_score(s * ei.mi->space_weight(), 0), Weights[Space]);
+ }