News for hackers. Stuff that matters.
Re:Students at Berlin University Build Chess Game on Ethereum by mikeash on Tuesday September 06, 2016 @12:49PM (#12437342)
Those aren't stalemates, technically speaking. Such a game would end either when the players both realized it's pointless and agreed to a draw, or when it's gone on long enough for the same position to repeat three times, and one player claims a draw. The second case may well be computationally infeasible too, since it would involve keeping and searching the entire history of the game.
Re:Students at Berlin University Build Chess Game on Ethereum by aweinstock on Tuesday September 06, 2016 @02:42PM (#12438269)
Searching the history to enforce the threefold repetition rule[1] wouldn't be efficient, but the fifty-move rule[2] could be pretty cheaply implemented (one cell of state for a counter, an increment-and-check per move, and resetting the counter to 0 on the relevant moves).

[1]: https://en.wikipedia.org/wiki/Threefold_repetition [2]: https://en.wikipedia.org/wiki/Fifty-move_rule

Re:Students at Berlin University Build Chess Game on Ethereum by oli5679 on Tuesday September 06, 2016 @02:33PM (#12438192)
Edit - I suppose it is a draw rather than a stalemate

Fide Rules 5.2 (B)

The game is drawn when a position has arisen in which neither player can checkmate the opponent’s king with any series of legal moves. The game is said to end in a ‘dead position’. This immediately ends the game, provided that the move producing the position was legal. (See Article 9.6)

Re:Students at Berlin University Build Chess Game on Ethereum by mikeash on Tuesday September 06, 2016 @02:51PM (#12438322)
Oh yes, I was thinking of a case where checkmate is theoretically possible, but where your opponent can thwart it indefinitely with good play. But as you say, that's a draw rather than a stalemate. Which is not a particularly important distinction, I will admit!
Re:Students at Berlin University Build Chess Game on Ethereum by oli5679 on Tuesday September 06, 2016 @03:13PM (#12438496)
No worries..

Programming all the draw scenarios in chess wouldn't be completely trivial. If you add clocks to the game then you also need to account for when you flag but your opponent cannot win the game with legal moves. There are some strange edge-cases here for pawns vs minor pieces.

Example:

https://www.chess.com/forum/view/livechess/draw-by-insuffici...

Re:Students at Berlin University Build Chess Game on Ethereum by Scarblac on Wednesday September 07, 2016 @06:29AM (#12442121)
The starting position is probably "a case where checkmate is theoretically possible, but where your opponent can thwart it indefinitely with good play".
Re:Students at Berlin University Build Chess Game on Ethereum by mikeash on Wednesday September 07, 2016 @10:02AM (#12443423)
Heh, indeed. I think what I meant was that your opponent can thwart it, in practice, given the actual abilities of both players. Things like the 50 move rule and the repetition rule are ways to detect this condition without actually having to figure out a way to analyze their abilities to decide whether a position is practically unwinnable.
Re:Students at Berlin University Build Chess Game on Ethereum by Scarblac on Wednesday September 07, 2016 @06:28AM (#12442118)
Yes, that one is quite hard to get right for normal chess engines too, and it usually isn't done.

E.g. if both sides have only a bishop left, then if the two bishops are on squares of the same color checkmate isn't possible, but if they are on different colors then checkmate is possible in a corner. Or pawn formations in the middle of the board that prevent breakthroughs.

Most online chess sites only consider the obvious case of king + bishop or knight vs king to be a draw under that rule (and king v king, obviously).