Author: Chrilly Donninger
Date: 05:47:51 12/13/05
Just for the curious, below is the code for the Rybka-Mate bug. I have seen
another bug in the Beta-Code too. There are in every programm hundreds of bugs,
so it would be more surprising to say: I have seen no other bug.
.text:0040CD07 mov ebp, [esp+868h+var_854]
.text:0040CD0B cmp ebp, 0FFFF810Ch
.text:0040CD11 mov dword_667A14, edi
.text:0040CD17 jnz loc_40CDCA
.text:0040CD1D mov eax, [esp+868h+arg_C]
.text:0040CD24 neg al
.text:0040CD26 pop edi
.text:0040CD27 pop ebx
.text:0040CD28 pop esi
.text:0040CD29 pop ebp
.text:0040CD2A sbb eax, eax
.text:0040CD2C and eax, 0FFFF8300h
.text:0040CD31 add esp, 858h
.text:0040CD37 retn
In C this reads as:
if(Bestscore == -32500( // No legal move found
if(InCheck) {
return -32000;
}
else { // Stalemate
return 0;
}
}
The bug is, that all mates are the same. In fact shorter mates are better for
the mate-giving side (or worse for the mated side) than longer mates. One has to
subtract the Plies/Distance from the starting position.
The bug is in my opinion a consequence of a bad design decision. There are 2
different "minus-infinite" values. In BestScore minus infinite is -32500, for
mate its -32000. If one sets bestscore at the first place to -32000+Ply one gets
cleaner and more efficient code and avoids the bug.
I had the same bug in Nimzo 1.0. But I must admit, that Rybka 1.0 is stronger.
Chrilly
This page took 0.02 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.