Before commenting on some of the points above, I would like to add one general remark. The misunderstandings regarding terminology like "depth" and "ply" are quite typical and occur frequently. I think they are caused by our lazyness to use proper words within discussions or verbal descriptions of programming concepts. Instead, much too often we are tempted to just use variable names from our own programs. But these are in fact the most ambiguous things I can ever think of since there is no standard at all, and everyone uses similar words but with different meanings. It would be much better, for instance, if we could agree on a slightly improved vocabulary for discussions, like:Fguy64 wrote:OK well that makes sense. SO I guess I am wrong, and I also misinterpreted Jesper's remark.hgm wrote:Well, if a mate-in-one does not produce a beta cutoff, you did not set beta properly. It is as simple as that. It makes no sense at all to search other moves after finding a mate-in-one...Fguy64 wrote:And as for my original point, it is this ply dependant mate score that prevents a beta cutoff from happening at all "at the first level". as I defined 1st level. Saying no 1st level beta cutoff is just my way of saying "all moves are searched".
Somehow we are not on the same page. We differ, but I'm not sure why. I suspect some differences in how we define ply and depth.
Jesper remarks that mate in 2 needs a 3 ply search, but I need ply=4 becuase it is at the 4th ply that determines that there are no possible moves. always mate in n moves requires ply = 2n.
I suspect somehow I may not be as efficient as I could be in my algorithm. I have no problem solving any checkmate, but ...
I need to return to the drawing board with this question, I'll be back later.
- "remaining depth" or "depth left" for the number of plies that are left to play from the current node until reaching the full search horizon;
- "height" for the number of plies that have been played from the root node to the current node (the height of the tree until here);
- "maximum search depth" for the number of plies from the root node to the horizon, for the current iteration.
The word "ply" originally means nothing else than a "half move". Using it for any of the concepts above when discussing with others seems to cause too many ambiguities. However, "ply" may still be a good choice as a variable name. But sometimes it is also used for the number of plies having been played since the beginning of the whole game.
Regarding mate and beta cutoff: A mate in one is always the optimal value the side to move can reach from a legal position. So if the goal of the search is to find the best move and its evaluation, finding a move at the root that immediately delivers checkmate means that you have found an optimal move, you can't improve anymore on it. And the mechanism to get this done automatically is to set beta for the root search to VALUE_OF_MATE_IN_ONE_PLY. If you don't do this and find a mate in one, the search will continue and check all other root moves but none of them will return with a better move and value, so it is wasted effort since the usual rule is to select the first of possibly several moves with the same value returned by the search.
Regarding the maximum search depth you need to detect a mate in N: This is about terminology again. "Mate in 2" means the moving side needs to make two moves until checkmate. Since the moving side (at the root) makes the first but also the last move, the total length of each forced mating sequence starting at a given node (here: root) is always an odd number. "Mate in N" with N > 0 means exactly "Mate in (2*N-1) plies". A similar rule is valid for "Checkmated in N", this always means that an even number of plies is needed, so you have "Mate in 2*N plies".
Sven