🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #5053

Bug fixes for PawnValue()

#5053
From: Chua Kong Sian
Date: Thu, 24 Mar 1994 01:22
25 lines
1341 bytes
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
Technical Details
Message-ID: <2mqq1f$s7d@nuscc.nus.sg>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!raffles.technet.sg!nuscc.nus.sg!nsrccks

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,41a90f3084b72a9e,start
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 1994-03-23 17:22:55 PST
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!raffles.technet.sg!nuscc.nus.sg!nsrccks
From: nsrccks@leonis.nus.sg (Chua Kong Sian)
Newsgroups: gnu.chess
Subject: Bug fixes for PawnValue()
Date: 24 Mar 1994 01:22:55 GMT
Organization: National University of Singapore
Lines: 25
Message-ID: <2mqq1f$s7d@nuscc.nus.sg>
NNTP-Posting-Host: leonis.nus.sg
X-Newsreader: TIN [version 1.2 PL0]