I think your problem is a different one. At the end of eval() you correctly negate "value" if black is the moving side. So the main part of eval() must assign positive numbers to "value" for something that is good for white and negative numbers for things that are good for black. But you don't do that, what you do is:
if (tmp & b->sidemask[b->side]) {
...
value += ...
} else {
...
value -= ...
}
which means: if you find a piece of the moving side then you do += else -=. This together with negating if black is to move always leads to an evaluation from white viewpoint which explains your flipping of signs.
Sven Schüle wrote:I think your problem is a different one. At the end of eval() you correctly negate "value" if black is the moving side. So the main part of eval() must assign positive numbers to "value" for something that is good for white and negative numbers for things that are good for black. But you don't do that, what you do is:
if (tmp & b->sidemask[b->side]) {
...
value += ...
} else {
...
value -= ...
}
which means: if you find a piece of the moving side then you do += else -=. This together with negating if black is to move always leads to an evaluation from white viewpoint which explains your flipping of signs.
Furthermore the same bug that I described in my previous post applies to your mobility eval code as well, I hope you already fixed it (...->side to be replaced by WHITE).