Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug fixes for PawnValue()

4 views
Skip to first unread message

Chua Kong Sian

unread,
Mar 23, 1994, 8:22:55 PM3/23/94
to

In eval.c, PawnValue (), there is a nasty bug in the following lines.

r = rank - (side == black) ? 1 : 0; and
r = rank + (side == white? ? 1 : 0;

The result is that rank gets decremented/incremented by 1 irregardless
of the value of side. To fix this, change to the following

r = rank - ((side == black) ? 1 : 0);
r = rank + ((side == white) ? 1 : 0);

Now the code works fine. This change is very important if we were to try
it with the following position.

W: Kh2 Pa3
B: Ka2 Pf3

Without the fix, gnuchess is unable to find the win starting with 1.a4
and instead plays 1. Kg3.

I believe there are certain other places where code like the above is
being employed. In that case, the ?: expression has to be in parentheses.

Kong Sian

0 new messages