Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Crafty's Stalemate Eval Code

Author: Robert Hyatt

Date: 13:25:05 02/04/04

Go up one level in this thread


On February 03, 2004 at 18:57:12, Matthew White wrote:

>On February 03, 2004 at 18:26:16, Robert Hyatt wrote:
>
>>On February 03, 2004 at 18:11:23, Matthew White wrote:
>>
>>>This message is probably directed to Bob. I was reading through the eval code in
>>>Crafty 19.9, and I noticed the function EvaluateStalemate which only tests for
>>>stalemate if the side to move has no pawns and no pieces. There are many cases
>>>when the side to move could have both pawns and pieces on the board and still be
>>>stalemated. For example, in the following position, white cannot take black's
>>>queen with Qxf3 because an immediate stalemate results (after Kh4 Qg3 or Qxg4, a
>>>stalemate is forced anyway). By the way, adding a black bishop on h8, it is
>>>still a stalemate (see the second diagram). I think that the correct way to
>>>detect stalemate is the side to move has no legal moves and is not in check. I'm
>>>guessing that there was some optimization that led to this code, but it causes
>>>Crafty to miss out on draws by stalemate in some hopeless positions.
>>>Incidentally, the position that brought about the stalemate defense is included
>>>as the third diagram (from Gelfand-Kramnik, Candidates Match Game 6 1994). The
>>>key move is 67... Qc1! because Qxd8 leads to rapid stalemate. Gelfand played 68.
>>>d5 in the actual game, but still only drew.
>>
>>Note that the code is only used for one purpose...
>>
>>To handle the problems that occur in certain types of drawn positions that get
>>evaluated wrongly.  All I care about is a lone king that has no moves,
>>primarily, as it wrecks a few special-case evaluations I do such as bishop + rp.
>>It is not intended to catch all stalemates, that is the purpose of the search.
>>In general, if one side has been stalemated, then the search would have already
>>found it and returned the right score.  This just prevents thinking one side can
>>win an ending if the other king can not move, in special cases...
>>
>>
>>
>>
>>>
>>>[D]3Q4/4R1pk/p4p1p/P4P1P/3P2P1/5qK1/8/8 w - - 0 4
>>>
>>>Crafty happily takes the queen though, and a stalemate results.
>>
>>This has nothing to do with the stalemate evaluation code.  This is a result of
>>the searching deciding that a draw is the best score it can produce.  IE comment
>>the code out and try it.   Nothing will change.  The main intent here is to
>>catch the case of (say) king + bishop + right rook pawn that is not a win if the
>>opponent king has been stalemated in the position being evaluated...




>Ahh, okay, so it doesn't try to take the slowest path to draw if it is up
>material?

Yes, but not as you think.  It turns the tables off after enumerating all the
moves that lead to a draw (and eliminating those that lose of course).  It then
does a normal search to pick the best of the drawing moves without benefit of
the tables, so it won't chuck material out the window since all roads lead to a
draw.  This is called "swindle mode" in crafty.  Hoping to swindle you by
letting you have ample opportunities to make a critical mistake.  :)








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.