Re: Hashing and mate scores
Posted: Thu Oct 04, 2007 12:07 am
That's the point. This works automatically. When you pull a score out of the hash table and it is a mate score, you just add or subtract the current ply from it depending on whether it is negative or positive. And you are done. When you store a score in the hash table, and you notice it is mate, you do the opposite and subtract or add ply. That makes all hash scores and bounds relative to the position/depth they represent.Karlo Bala wrote:Yes, that is perfectly OK in plain AB, but I'm curios how it interacts with HT?Chan Rasjid wrote:The following is simple reading and does not need much thinking.
An idea is easy after we have the understanding and difficult when we do not yet grasp it in proper perspective. I wish to add another easy approach to understand Muller's pseudo codes that involve shifting mate scores, alpha, beta by +1 / -1 and also some other things.
Alpha-beta search() uses a range of integers (-infi, +inf) to represent something call "scores". Scores have a non-mate range where :-
100 = 1 pawn advantage,
-300 = a bishop disadvantage, ....
and they represent likelihood of winning or losing the game. search() is recursive and passes a score on return and on calling search(), it passes up two score arguments in alpha, beta which are score bounds. Passing non-mate scores around in search() present no inherent problem as they may be interpreted consistently relative to any nodes in the chess tree. But this is true only generally.
Say we made a great discovery about evaluation in chess programming. It involves using a huge 8MB tables that is used to scale the value of pieces. And it need to scale in strange manners. Besides other conditions, a queen = 900 at root and scales to 1800 at ply 127. Rook scales downwards, worth 500 at ply 127 and worth 350 at root. Bishops... Knights...etc.
We call score= eval(ply) and then we got stuck. This number can neither be passed downwards nor upwards in the usual manner. If alpha = 125 is passed up as argument and it travels 20 plies up, then when interpreted, the number 125 has another meaning. Numbers don't get passed around together with consistent meaning. We may need to do score mappings ,and maybe inverse mappings, to get our great idea to work with alpha-beta.
Getting back to mate scores. In the consistent score method(10000 - D), x =-infi + 50 represent a checkmate node at ply 50 relative to root. If x is passed around by search(), it is ok as it can be interpreted consistently at every node of the chess tree. In the inconsistent score method, -infi = checkmate, mate in 1/2/3/4... is -inf+1,-inf+2,-inf+3,-inf+4, but relative to a node. If search() at ply = 7 somehow got hold of a number x =-infi + 50 and passed x upwards, and if it propagates 25 plies up and got interpreted as mate-in-fifty relative to that node, the meaning is wrong by 25 mates. This explains why in Muller's pseudo codes, there is a need to adjust scores with x = x+1 and x = x-1
Best Regards,
Rasjid
Not just how to put score int HT but also how to retrieve?