Page 1 of 1

Do you understand the reason for the following code in Toga

PostPosted: 08 Aug 2005, 11:28
by Uri Blass
code in Toge1.0 beta2:

if (op[colour] >= -22) // Thomas king safe?
op[colour] -= (attack_tot * KingAttackOpening * KingAttackWeight[piece_nb]) / 256;
else
op[colour] -= ((attack_tot * KingAttackOpening * KingAttackWeight[piece_nb]) / 256) * 1;


It seems to me that
op[colour] -= (attack_tot * KingAttackOpening * KingAttackWeight[piece_nb]) / 256; from fruit's code has the same effect and I do not understand the reason for the change from fruit's code.

Uri

Re: Do you understand the reason for the following code in T

PostPosted: 08 Aug 2005, 12:36
by Roman Hartmann
That looks really a bit odd. Seems to me that there is no need for the if/else statement ...

Roman

Re: Do you understand the reason for the following code in T

PostPosted: 08 Aug 2005, 12:41
by Tord Romstad
Uri Blass wrote:code in Toge1.0 beta2:

if (op[colour] >= -22) // Thomas king safe?
op[colour] -= (attack_tot * KingAttackOpening * KingAttackWeight[piece_nb]) / 256;
else
op[colour] -= ((attack_tot * KingAttackOpening * KingAttackWeight[piece_nb]) / 256) * 1;

I often have similar code in my engine (but usually only in private development versions, I try to remove it before a public release). Thomas is probably experimenting with various factors different from 1, but because of lack of testing or something similar he has decided to be conservative and use a factor of 1 in the public version.

Tord