
I guess there is nothing left then but finally trying to do something about it, rather than beating around the bush. Print the moves+scores after 1.Bd6+ Bxd6.
Moderator: Ras
huh?!?hgm wrote:Well, if mate scores are not being stored, storing wrong mate scores can obviously not be the cause of the error. It is just another design flaw.![]()
I guess there is nothing left then but finally trying to do something about it, rather than beating around the bush. Print the moves+scores after 1.Bd6+ Bxd6.
The difference with mate scores in the TT is that they need to be adjusted as they move up the tree, e.g. if the TT has a cutoff with mate in 3 ply, the search needs to return -mate in 4 ply.Fguy64 wrote:hmm, I make no special consideration for mate scores.hgm wrote:Well, the most likely explanation then is that you do not properly correct the hash mate scores during storing and probing. I don't suppose you use a delayed-loss bonus, so to get any measurement of the mate distance, you would have to use this silly method of fudging the mate scores with the current depth, which again requires you tocorrect them if probing takes place at a different depth than storing. This is notoriously error prone, and probably also the problem here.
The hash type is initialized to typeAlpha at the beginning of the search function, then change to typeExact when there is an alpha update. At the end of the search function hval=alpha is written along with the type. Beta writes store hval = beta.
My hash probe is the first thing that happens at each node, before the termination condition (depth==0).
I'll have a look around for information on hashing and mate scores. Usually I use Moreland's pages, I'll try there first.
p.s. oooh, mate scores aren't being stored...
Good idea indeed, I slept only about 3 hours the last night myself and now it is here almost half past two AM ...Fguy64 wrote:Thanks Filip, I don't think I can absorb your post tonight, but tomorrow when I am fresher I will look at it closely.
I think that you are both talking different things. I guess that JW just tried to suggest you to use another functional scheme of handling mat scores.
I will respond to JW point though. If I am just doing transpositions, and there is a cutoff from a previous write, but I need the extra ply to know it is the mating position because I needed another ply to determine there is no legal responses, then the question becomes how am I supposed to know it is a mate if the cutoff prevents me from determining that there are no legal responses?
I can assure you that it is better to fix those bugs now. Surely they are not going to disappear by any magic.I am tired and none too certain, but my gut is telling me not to waste too much time with mate scores and hashing in my current fixed depth version of the algorithm, that once I add in iterative deepening along with a qSearch with a check extension might make the problem disappear? Just a guess.
I can assure you that it is better to fix those bugs now. Surely they are not going to disappear by any magic.[/quote]tvrzsky wrote: I am tired and none too certain, but my gut is telling me not to waste too much time with mate scores and hashing in my current fixed depth version of the algorithm, that once I add in iterative deepening along with a qSearch with a check extension might make the problem disappear? Just a guess.
I meant pawn endings.tvrzsky wrote:Hi Fred,
do not give up!
I believe that your bug (as has been pointed out by HGM) lies in handling mat scores in your hash table (TT). You have to realize that mat score is something very different from ordinary (material + position evaluation) score. It reflects distance from the root to the given checkmate position and in this form it works perfect with plain AlfaBeta without TT. But it does not work with TT. Why? Because when storing mat score then what you in fact need to store is not distance from the root but from your ACTUALL POSITION WHICH ARE YOU STORING to the position of checkmate. Consequently you have to adjust every mat score before storing to TT like this:
a) if the score is positive than add your current ply to it
b) if the score is negative than subtract your current ply from it
After retrieving mat score from the TT adjust it like this:
a) if the score is positive than subtract your current ply from it
b) if the score is negative than add your current ply to it.
Please note that the fact that you do not store checkmate position to the TT does not mean that you do not store mat scores. Of course you store them in parents of this checkmate node.
I think that storing mat scores without adjusting explains perfectly behaviour of your engine. The fact that it finds mat in 5 plies within the 4 plies search in itself is not a bug but a feature, yes, it is well known feature of TT which manifests e. g. in pawn hash tables
as well (Fine 70) and which consists in enhancement of your search depth beyond nominal depth. As explained by HGM your engine probably searched at first line 1. a7a8Q Bb8 2. Qxb8++. Position after 1. a7a8Q Bb8 got stored (but with incorrect unadjusted score 9997). Now after 1. Bd6+ Bxd6 2. a7a8Q+ Bb8 this position ocurred again and you retrieved the incorrect score 9997.
So only wrong thing here are incorrect mat scores. And this phenomenon of course can not manifest if you retrieves scores from TT only with condition stored depth == current depth because then distance to checkmate from the root and from the actuall position is the same both when storing and when retrieving from TT.
Code: Select all
if (score > -(10000-MAX_PLY) && score < 10000-MAX_PLY) store_in_TT(score, valueType, ...);
I didn't reply that it was "impossible that the handling of mate scores in hash was the problem because I wasn't storing them" because my initial reaction was that the fact that I wasn't storing them was the problem. This morning I am not so sure what the problem is. Maybe it is not mate scores at all.Sven Schüle wrote:You have written that you do not store mate scores in the TT. Others have written that they think your bug may be related to handling of mate scores in the TT. You did not reply to them that this were impossible because you don't store mate scores.
So what do you really do: Do you store mate scores, or don't you?
...