Search found 17 matches

by rgoomes
Fri Sep 29, 2017 12:40 am
Forum: Programming and Technical Discussions
Topic: Combining hashing with parallel search
Replies: 2
Views: 7064

Re: Combining hashing with parallel search

Reading / storing of structs is not atomic, unless they happen to fit in a 64-bit machine word.

When hashing, you should be prepared to handle the situation where you sometimes get faulty information. Even with a 64-bit key this occasionally happens through key collisions. Often enough to make the ...
by rgoomes
Sat Sep 23, 2017 11:15 pm
Forum: Programming and Technical Discussions
Topic: Combining hashing with parallel search
Replies: 2
Views: 7064

Combining hashing with parallel search

Just gained the motivation to do my first implementation of parallel search but first I tried to do parallel perft with hashing in order to test some ideas and the correctness of some code. In this test I have stumbled with one problem. Very rarely, when multiple threads try to store and lookup the ...
by rgoomes
Sun Feb 28, 2016 11:12 pm
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

Shoot... that is where ALL of my hash-related bugs have shown up. :) (when hashing is enabled.)

hehehe :)

I just found the problem.. It was pretty simple. I was calculating the node type(flag of the transposition table in the code) after adjusting the best score to be stored in the transposition ...
by rgoomes
Thu Feb 25, 2016 7:45 pm
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

I think I see the issue.


if(val > alpha){
alpha = val;
if(val >= beta)
break;
update_pv(it, ply);
}


Here, if the value >= beta, you exit the loop and go on to store this alpha in the transposition table, but you don't update the PV, meaning the PV could have erroneous moves after the ...
by rgoomes
Wed Feb 17, 2016 6:32 pm
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

My point was not that you needed the - 1 or + 1, but that you have to carefully look. For example, why not do this:

when you store a mate score, display the tree and print the actual score and the stored score. When you hit on a position with a mate score, display the position, the table score ...
by rgoomes
Tue Feb 16, 2016 12:39 pm
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

Note we don't match exactly. Here is mine again:

if (val > 32000)
val -= ply - 1;
else if (val < -32000)
val += ply - 1;

Note the val += ply -1 or val =- ply - 1. Perhaps that -1 is what you are missing?

Subtracting one ply doesn't do anything. This is the scores I'm getting for the last ...
by rgoomes
Tue Feb 16, 2016 12:20 am
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

I am hoping you meant

val = - alphabeta(-beta, -alpha, etc)???

If so, that should not be a problem. I would re-factor your code so that you only have one call to alphabet(), not one for in check and one for not in check, which is a good way to introduce bugs that are hard to find...

yes, its ...
by rgoomes
Mon Feb 15, 2016 10:05 pm
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

I do exactly the same thing. On storing:

if (value > 32000)
value += ply - 1;
else if (value < -32000)
value -= ply - 1;

In Crafty, any score > 32000 or < -32000 has to be mate, there is no way to have a 320 pawn advantage of deficit.

On probing:

if (val > 32000)
val -= ply - 1;
else if ...
by rgoomes
Sat Feb 13, 2016 1:01 am
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

Re: TT Mate scores

Mate scores are special. They represent mate in N move from the ROOT position. When you store a mate score internally inside the tree, you have to adjust it to mate in N minus something from the current position. Simple example.

the mate sequence looks like this:

P1 - P2 - P3 - P4 - P5 <mate in 3 ...
by rgoomes
Wed Feb 10, 2016 5:30 pm
Forum: Programming and Technical Discussions
Topic: TT Mate scores
Replies: 18
Views: 19401

TT Mate scores

I'm having some trouble understanding how I can store and then retrieve the mate scores from the transposition table. I couldn't find in the website chessprogramming.wikispaces.com any useful info about this matter.

For example in this test position:
3k4/1R3p2/2p3pp/8/8/pR6/p7/4K3 w - - 0 1
There ...