Skip to content

Commit 567967b

Browse files
authored
Update eval.cpp
1 parent 76b2f00 commit 567967b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

eval.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,16 @@ namespace engine::eval{
197197
while (occ) {
198198
Square i = (Square)pop_lsb(occ);
199199
auto p = board.at(i);
200-
mgScore += mg_pesto_table[piece_of(p)][color_of(p) == BLACK ? square_mirror(i) : i];
201-
egScore += eg_pesto_table[piece_of(p)][color_of(p) == BLACK ? square_mirror(i) : i];
200+
int sign=1;
201+
if (color_of(p)==BLACK){
202+
_sign=-1;
203+
i = square_mirror(i);
204+
}
205+
mgScore += _sign*mg_pesto_table[piece_of(p)][i];
206+
egScore += _sign*eg_pesto_table[piece_of(p)][i];
202207
}
203208
}
204209
int finalScore = ((mgScore * phase) + (egScore * (256 - phase))) / 256 * sign;
205210
return finalScore;
206211
}
207-
}
212+
}

0 commit comments

Comments
 (0)