"is there a legal move for white?").Īlthough a naive algorithm for determining checkmate would test O(n!*n^m) positions, the problem "Is a given a position checkmate?" may not be NP-hard. Assume we are interested in whether black has just won by checkmate (i.e. By carefully eliminating large parts of the search space simultaneously, it is possible to achieve practical performance alongside correctness.įor this section, we assume that the maximum board size is 8x8, and we are given a position with n timelines and at most m possible moves originating from each timeline. The original release of the official client suffered from this problem, and the updated version incorrectly considers some positions to be checkmate (this is not known to have affected any real games). Because of this, computer programs can take a very long time when trying to determine if a position is checkmate. If there are n active present timelines, each of which has m possible moves, then there are n^m movesets to consider (more if branches can be created from more than one timeline, in which case order matters). There's at most one king, which makes it even easier, since it becomes obvious which moves might deal with the check. In 2D chess, checkmate detection is easy since there are a bounded number of possible moves (a player has at most 16 pieces, each of which has at most 27 moves), so it's possible to iterate through all of them and test whether any of them escape check. If the position is not check and there are no legal movesets, the result is a draw. a king could be captured if a pass is made on all present boards) and there are no legal movesets. A position is checkmate if it is check (i.e.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |