Author: Robert Hyatt
Date: 17:16:58 06/18/02
Go up one level in this thread
On June 18, 2002 at 18:43:29, Sune Fischer wrote: >On June 18, 2002 at 17:56:58, Robert Hyatt wrote: > >>On June 18, 2002 at 16:02:45, Sune Fischer wrote: >> >>>On June 18, 2002 at 12:11:57, Robert Hyatt wrote: >>>> >>>>OK... define "MATE" as 32768, for now. >>>> >>>>If you find a move at the root that leads to a mate in 4, the score >>>>will typically be 32768 - 8 since you find you are mated at ply=8 and >>>>you return MATE-ply (I do, anyway). Therefore, the root score that >>>>gets backed up will be 32760, and so far, all is well. That means that >>>>the "mate score" that gets returned from ply = 8 has to be - ( MATE - PLY ) >>>>so that - is bad for the side on move at ply=8. >>>> >>>>Note that you have 4 moves for the program in the path, the move at >>>>ply=1, 3, 5 and 7. When you store a hash table entry at ply=7, you >>>>should store MATE-1, since the move at ply 7 will result in a MATE at >>>>ply=8. At ply 5, you should store MATE-3, at ply 3 you should store MATE-5 >>>>and if you want to store the entry at the root, it would be MATE-7. >>>> >>>>All this means is that at any point in the path that terminates in a mate >>>>score of any kind, you have to adjust the score so that it is a mate-in-N >>>>from the current ply, not from the root. Because the root score is wrong >>>>at the current ply, since we are _closer_ to the final mate than we were at >>>>the root of the search. >>>> >>>>If that isn't clear enough, ask again. You can find how I return a mate score >>>>by looking at the bottom of search.c in Crafty (look for string MATE). You can >>>>find how I adjust the mate score before I store it in the hash table by looking >>>>at hash.c, module Store()... >>>> >>>>Bob >>> >>>I think that _is_ what I'm doing!? >>> >>>#define CHECKMATE 100000 >>>#define CMSCORE 99000 >>> >>>search() { >>>.. >>> if (!movesfound) { >>> if (InCheck(wtm)) >>> score=-CHECKMATE+depthroot; >>> else >>> score=DRAWSCORE; >>> } >>>... >>>} >>> >>>hasprobe() { >>>... >>> switch (phash->flag) { >>> case HASH_EXACT: >>> if (abs(score)>CMSCORE){ >>> if (score>0) >>> score-=depthroot; >>> else >>> score+=depthroot; >>> } >>>... >>>} >>> >>>hashstore() { >>>... >>> if (abs(score)>CMSCORE){ >>> if (score>0) >>> score+=depthroot; >>> else >>> score-=depthroot; >>> } >>>... >>>} >>> >>>"depthroot" is just distance to the root position we are searching, I assume it >>>is identical to yours "ply" variable. >>> >>>Something must be wrong, I get weird results, it does work fine, it seems, but >>>when I look at the log I'm worried. >> >>One last thing: when you store the score, how do you do that? IE I use N >>bits for the score, and to avoid sign-extension for negative numbers, I add a >>constant larger than any possible negative score and then store the sum. If >>you do that, you aren't suffering from an overflow??? IE 1 bit can make a big >>difference. > >No overflow, I'm using a full 4 byte signed integer for the score. >That's because I'm using milipawns, so two bytes is not enough. >Three bytes would be enough, but that's just an optimization I can play with >later. > >>> >>>This position was from a quick test game, it's mate in 3, but I get mate in 1 >>>three times in a row, but it doesn't have a problem playing the right moves, >>>really strange... >>>[D]1r2qrk1/n5p1/1p1p2P1/p2p2P1/2P1pPK1/P1PB2P1/2Q5/1R5R w - - 0 1 >>> >>>-S. >> >> >>I get a mate in 3. I make a move, get mate in 2, make a move and get >>mate. All from the hash table after the mate in 3 is found... > >...but you couldn't find anything wrong with what I pasted? >I don't see anything wrong with it either, matescore is first adjusted for >distance to root, then when recorded to hash it is readjusted to be the distance >from where I save to the mate, and when I probe it's adjusted again by adding >the current distance to root. >Why tha' heck isn't that working?? > >-S. I will look at it carefully tonight. One thing I did find years ago was that adjusting everything that is >= MATE-100 was a mistake. IE I don't adjust "bounds", just EXACT scores. That used to cause some interesting mate scores to pop up from time to time...
This page took 0 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.