# Computer Chess Club Archives

## Messages

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

Author: Uri Blass

Date: 17:59:07 12/14/05

Go up one level in this thread

```On December 14, 2005 at 20:42:27, Dann Corbit wrote:

>On December 14, 2005 at 19:50:02, Uri Blass wrote:
>
>>On December 14, 2005 at 19:25:38, Dann Corbit wrote:
>>
>>>On December 14, 2005 at 19:18:28, Uri Blass wrote:
>>>
>>>>On December 14, 2005 at 18:53:21, Dann Corbit wrote:
>>>>
>>>>>On December 14, 2005 at 08:00:00, Vasik Rajlich wrote:
>>>>>
>>>>>>On December 14, 2005 at 04:44:15, Steve Maughan wrote:
>>>>>>
>>>>>>>Vasik,
>>>>>>>
>>>>>>>>The problem is when the hash entry ages.
>>>>>>>
>>>>>>>This is easy to get around - just store the distance to mate from the *position*
>>>>>>>(i.e. not the root) in the hash table.
>>>>>>>
>>>>>>>In pseudo code:
>>>>>>>
>>>>>>>procedure push_hash(position)
>>>>>>>begin
>>>>>>>	if winning_mate_value_in_hash then
>>>>>>>		hash_draft_depth += position's_ply_from_root
>>>>>>>	else if losing_mate_value_in_hash then
>>>>>>>		hash_draft_depth -= position's_ply_from_root
>>>>>>>	store(position)
>>>>>>>end;
>>>>>>>
>>>>>>>procedure probe_hash(position)
>>>>>>>begin
>>>>>>>	if found_in_table(poistion) then
>>>>>>>	begin
>>>>>>>		get_hash(position)
>>>>>>>		if winning_mate_value_in_hash then
>>>>>>>			hash_draft_depth -= position's_ply_from_root
>>>>>>>		else if losing_mate_value_in_hash then
>>>>>>>			hash_draft_depth += position's_ply_from_root
>>>>>>>	end
>>>>>>>end;
>>>>>>>
>>>>>>>I hope this helps!
>>>>>>>
>>>>>>>Regards,
>>>>>>>
>>>>>>>Steve
>>>>>>
>>>>>>Steve,
>>>>>>
>>>>>>thanks, I guess this also works - although it's a bit dirty.
>>>>>
>>>>>What's the other way to do it?
>>>>
>>>>see my post in
>>>>
>>>>http://www.talkchess.com/forums/1/message.html?470096
>>>
>>>Can't the same position (therefore) have a huge number of different scores then
>>>(depending on where we saw it in the tree)?
>>>
>>>Tbis way seems more complicated to me.
>>
>>
>>You are right.
>>I did not think about that problem.
>>
>>I do not use hash for pruning so I have no experience with that problem.
>
>I am curious about why you do not use hash for pruning.
>The chances of collision are very low and you can detect that as well.
>
>Are you worried about losing the pv?

The main reason are the following reasons:
1)I have partial extensions and it is stored in different variables than the
normal extensions so it is more complicated to store exact depth in the hash
2)part of my evaluation is dependent on the path and I do not want to lose it.
3)I am afraid from hash bugs.

I guess that I probably can improve movei by using hash for pruning but I think
that it may be better to start from clearly more simple search.

In latest movei that I did not send to you there is already another file that
has tscp search type.

I also did some other changes that are not relevant for playing strength
including having function to calculate the static evaluation(I also did some
small changes in it in the process because the evaluation of the version that
you have has some non static part that is about perpetual checks in the middle
of the evaluation and I decided to push it to the end of it).

I remmeber that the non static part helped me in earlier version and I do not
know how much it helps today but I guess today that static evaluation with
pruning based on hash like almost everybody does can help more.

I think that I may start trying pruning based on hash on another file of simple
search because I am afraid to try it on my complicated search that have
complicated conditions when to prune or reduce depth.

Uri

```