stalemate detection and pruning

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: stalemate detection and pruning

Post by syzygy »

hgm wrote:
syzygy wrote:The alpha-beta algorithm is well-defined. It requires you to assign the game-theoretic outcome of positions corresponding to terminal nodes (or a heuristic evaluation if you limit the depth and the game-theoretic outcome is not available). The manner in which the FIDE rules define this outcome is not important.
Not sure what you are driving at.
I've quite clearly stated what I disagree with. There is nothing in chess that violates any premise of alpha-beta. This pseudocode can be applied to chess just fine.
The FIDE rules define which moves are legal. Moving into check is not legal.
But to know what 'check' is, they first let you move there, and then you have to demonstrate that in the new position your king is 'under attack', i.e. the opponent can capture it.
That is one way of looking at it, but this is not part of the "abstract" alpha-beta algorithm.
Capturing is not legal either (but anyway impossible if no previous illegal moves were made). Art. 5.2(a) defines the game as drawn if the player to move has no legal move and his king is not in check.

Speed-enhancing tricks are good, but they are not part of the alpha-beta algorithm. If stalemate is to some extent incompatible with a speed-enhancing trick, that does not mean that stalemate violates a premise of alpha-beta.
Which speed-enhancing trick is incompatible with stalemate, then?
You saw a problem... If the problem has gone away, fine with me.
If it would be true that it is not allowed to capture the King, then you could never be in check!
You can read in the FIDE rules how everything is defined. Capturing a king is illegal. Check does exist.
Check is defined as the possibility to capture a King.
So you did not read the rules.
syzygy wrote:There is no rule that you can "claim" a draw in a stalemate position. A stalemate position, i.e. a position with no legal moves and without the king of the side to move under attack, is a draw.
That is the rule King-capture engines apply.
Ok, I misinterpreted your statement.
Also, for stalemate it does not matter whether there are pseudo-legal moves that would bring the king in check. So also this aspect of the rule you formulate is not present in the FIDE rules.
I think the formulation is correct: if there are no pseudo-legal moves at all in a stalemate situation, turn passing would still be the only way to not expose your King to check or in fact do anything at all). That something is the only way to achieve X, does not logically imply that there are ways that achieve not-X.
But if you say that something is the only way to not achieve X, then according to the normal rules of natural language interpretation there is a way to achieve X.

But your formulation was correct because you were talking about what King-capture engines do and not giving the FIDE definition of stalemate.