Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: The Code for the Rybka-Mate-Bug

Author: Chan Rasjid

Date: 16:09:14 12/13/05

Go up one level in this thread


On December 13, 2005 at 16:29:53, Robert Hyatt wrote:

>On December 13, 2005 at 11:52:03, Álvaro Begué wrote:
>
>>On December 13, 2005 at 08:47:51, Chrilly Donninger wrote:
>>
>>>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
>>
>>
>>I use the exact same solution that Chrilly proposes, combined with the "store
>>only bounds for mating scores in the hash table" idea that I picked from Bruce
>>Moreland's website. As far as I can tell, it works great.
>>
>>Álvaro.
>
>The question is "why store only bounds"?  Makes no sense to me.  I've always
>stored exact (corrected for distance to root) for mate scores.  Allows me to
>store all the EGTB mates as well.
>


I cannot see other than just store exact (corrected for distance to root) for
mate scores - nice and clean and never ever had problems.

Are there any SECRET benefits that we missed of the alternatives?

It is a strange world.

Rasjid

>Never understood the reasoning for not storing exact mate scores.  Never had a
>single problem doing so in either of my programs, spanning _many_ years...



This page took 0.01 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.