1 / 58

Kriegspiel: Discovering Certain Checkmates in Chess

Learn about the rules of Kriegspiel, a variant of chess where players can't see their opponent's pieces, and find out how to locate certain checkmates within a given move history.

tonyaj
Download Presentation

Kriegspiel: Discovering Certain Checkmates in Chess

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Kriegspiel Jason Wolfe

  2. Shall I fire on them now, sir? Not yet Kif; in the game of chess, you can never let your adversary see your pieces

  3. Outline • Introduction • Rules of Kriegspiel • Our Problem • Sample Kriegspiel Mating Problem • Data Structures and Algorithms • Exact Belief State • Exact Mating Algorithm • Efficient Belief State Implementations

  4. Rules of Kriegspiel • Same initial board, movement and mating rules as ordinary chess • Difference: we can’t see our opponent’s pieces, and we only know the consequences (capture, check) of our opponent’s moves • Playing Kriegspiel requires three chess boards and a referee (or online play)

  5. More Rules • Since players have limited knowledge of their opponents’ pieces, they don’t know in advance which chess moves will be legal • Possibly-legal moves can be illegal iff they are obstructed by one of the opponent’s pieces, or leave the player in check • On his turn, a player keeps attempting possibly-legal moves until one is accepted as legal; this becomes his actual move for the turn • Thus, a “turn plan” in Kriegspiel is a (truncated) permutation of the possibly-legal moves • Stalemate rules (position 3-peat and 50-moves) suspended because position includes knowledge about opponent’s pieces

  6. More Rules • The referee is the only source of information about the opponent’s pieces. • For each attempted move, he announces “Yes”, “No”, or “Impossible” • For captures, he announces the square at which capture occurred (but does not disclose the identity of either piece) • For checks, he announces check and the direction of check (row, column, long diagonal, short diagonal, or knight) • Checkmates and stalemates are announced, and the full board position is revealed to both players

  7. Basic Strategy • While the general objective is the same as chess (capture the opponent’s pieces and corner his king), uncertainty introduces several subsidiary objectives • Gathering information about the opponent’s pieces • Hiding one’s own pieces from the opponent

  8. More Basic Strategy • The effects of these factors can be seen even in the first few moves of a real Kriegspiel game • Less typical openings may be desirable, because they may not be anticipated • Power pieces should always be protected if possible • In general, all possible pawn captures should be attempted before trying other moves • Thus, we should be careful playing power pieces around probable locations of opponent’s pawns • Many variants include an ‘Any’ rule to speed up gameplay • Special care needs to be taken to protect against short mates such as Fool’s mate.

  9. Specifics of Our Problem • Specifically, we will be given a move history for which • White has 5 pieces on the board • Black has 2 pieces on the board • It is White’s turn to move, and given the move history a certain checkmate exists within 2.5 moves • Our problem is to discover a conditional move plan that is certain checkmate • This talk is focused on the goal of locating certain checkmate. This approach differs significantly from that for locating probable checkmates.

  10. More Specifics • Our problem is not as complicated as ordinary Kriegspiel • We are concerned with certain checkmates, which guarantee checkmate regardless of how our opponent plays • Because we don’t need to take probability into account, we don’t need to consider our opponent’s strategy • This means that (at least for fixed-depth mates) we can assume that the opponent can see our pieces (but not visa-versa)

  11. Two Problems • Discover (approximate) the current belief state given the move history • Search the game tree for certain checkmate, given the belief state calculated in (1)

  12. Example Kriegspiel Checkmate White to move and mate within 1.5 moves. Given the move history to this point, Black’s pieces are known to be in one of the above three possible positions.

  13. White’s Move Checkmate No Try Qb8

  14. Yes Knight Check Checkmate White’s Move Try Ne7

  15. Black’s Move Black’s Move Yes Opponent’s move(s) Yes

  16. White’s Move White’s Move Checkmate Checkmate Mate with Qh2 Mate with Qf8

  17. Initial Belief State Yes Knight Check Check-mate No Yes Yes Check-mate Checkmate Try Qb8 Try NeE7 Opponent’s move(s) Mate with Qh2 Mate with Qf8

  18. Basic Kriegspiel Mates • In ordinary chess, a king and rook or greater can always checkmate a lone king. • Interestingly, the same elementary mates are possible in Kriegspiel • Two elementary mates require randomization • King, bishop, and knight vs. king has a certain mate, but requires a possibly infinite number of moves • King and two bishops vs king has an epsilon-mate

  19. Kriegspiel Data Structures and Algorithms

  20. Belief States • The primary difference between Kriegspiel and chess is that in Kriegspiel, players must maintain a belief state of possible positions the opponent could be in • The simplest belief state representation is a list of possible board positions • In a real Kriegspiel game, a belief state is a possibility distribution rather than a list

  21. Exact Belief State • Operations on an exact belief state are simple • The initial state is simply the initial board position • When a player makes a move, he prunes positions from the belief state that are inconsistent with the referee’s response • For the opponent’s move, the belief state expands to the union of the successors of its component states, and is then pruned based on the referee’s response • When an exact belief state is split based on possible referee responses, the sum of the cardinality of the component belief states equals the cardinality of the original state (perfect information) • However, this representation is intractable since a real belief state could easily contain more than 1010 possible positions

  22. Exact Mating Algorithm • The exact belief state precisely captures what positions the opponent could be in, given some move history • The other part of the problem is mating search, given such a belief state • As we will see, this problem also has a relatively simple exact solution

  23. Exact Mating Algorithm (cont.) • The Kriegspiel exact mating algorithm • Branch (OR) over possible turn plans, looking for a certain checkmate • Branch (AND) over possible referee responses, fragmenting the belief state • If a sub-belief state contains stalemate, it is a loss. If it contains only checkmated positions, it is a win. Otherwise, if we are not yet at the maximum search depth, prune terminal positions from the belief state and continue search • Set the belief state to the union of its successor positions (simulating the opponent’s move) • Branch (AND) over possible referee responses, fragmenting the now-expanded belief state • If a sub-belief state contains checkmate or stalemate, it is a loss. Otherwise, go to step 1

  24. Initial Belief State Yes Knight Check Check-mate No Yes Yes Check-mate Checkmate Game Tree Try Qb8 Try Ne7 Opponent’s move(s) Mate with Qh2 Mate with Qf8

  25. Exact Mating Algorithm (cont.) • This search has three major branch points • Choosing a “turn plan”, a truncated permutation of the possibly-legal moves • The referee’s response to the legal move • The referee’s response to the opponent’s move • Since we may choose our turn plan but not the referee’s responses, the first branch is an OR-search and the other two are AND-searches. • We do not have to explicitly branch based on the opponent’s move, since this branching occurs within the belief state

  26. An Initial Problem • With 5 pieces at an average of 10 possible moves each, the first branching factor could be on the order of 1030 possible turn plans to check • If we know a move is illegal, it prunes our belief state; therefore, it seems that we must check all permutations

  27. The Solution • We are not just looking for the turn plan with maximum utility • any turn plan with utility less than 1 is unacceptable • If a “turn plan” contains a move which, if accepted, is not certain checkmate, it will not have utility 1

  28. The Solution (cont.) • This suggests the following simple algorithm for choosing a turn plan, which has a branching factor of only m2 rather than m! : • Start with an empty move plan and some belief state BS • Loop until BS does not change (failure) or is empty (success) • Loop through possible moves • If the move is certain checkmate if accepted, add it to the move plan and prune its acceptance set from BS

  29. Branching Factors • Optimistically, with 50 possible moves this branching factor might be as small as 100 • There are 2-10 possible referee responses for our move • There are 1-200 possible responses for our opponent’s move

  30. Heuristic improvements • The first stage can be improved by heuristic move ordering • Sizes of move’s acceptance sets • Heuristic likelihood move will cause mate • The second and third (AND) searches can be improved with heuristic state ordering • Larger belief states are less likely to be certain checkmate

  31. Current Status • My current Kriegspiel code, which utilizes the tools described so far, can solve the “example mate” in under a minute

  32. Another Improvement • If a belief state admits a state that is not checkmate in ordinary chess within the necessary depth, it does not admit certain Kriegspiel checkmate • Thus, a good tactic might be to sample a few positions (heuristically) before running the tree search on the full belief state • mating search in ordinary chess has significantly lower branching factors and amount of work per operation

  33. Efficient Belief States • With the exception of further heuristic improvement and sampling techniques, the mating algorithm is essentially finished • The simple belief state representation, on the other hand, is not tractable for real Kriegspiel problems • Thus, what we need to do now is develop a compact, accurate, and fast belief state implementation

  34. Belief State Methods • For mating search, the belief state needs to support the following four basic methods: • Make a specific move for player, and fragment the belief state based on the referee’s possible responses • Make all possible moves for opponent, and fragment the belief state based on the referee’s possible responses • Test whether a belief state with player-to-move contains any checkmate or stalemate positions • Test whether a belief state with opponent-to-move contains any stalemate positions or all checkmate positions; if neither, prune checkmate positions

  35. Unary Marginals • For move generation and (especially) terminal testing, a positional representation of the belief state is necessary • However, the exact positional representation is intractably large • A first compromise is to store only the “unary marginals”, the sets of possible board positions (including off-the-board) that each of the opponent’s pieces could possibly occupy • This approximation allows for a sound, but not complete, algorithm for discovering certain checkmate

  36. Exact Belief State Exact Belief State

  37. Unary Marginal Belief State

  38. Example (cont.) • The unary marginal approximation to the exact belief state admits 11 positions • Of these, only the original 3 positions are ordinary-chess checkmates! • Even if all the “decoy” states were ordinary-chess checkmates, there might be no Kriegspiel checkmate given this belief state

  39. Unary Marginal Characteristics • Storing the unary marginal belief state requires only 16 * 65 = 1040 bits • Move generation for us (White) is simple, because we know the positions of our own pieces exactly • Move generation for Black can also be done in constant time • But, the belief state will mix quickly. Pieces will only block others if their positions are known certainly • In general, when we split the belief state based on the referee’s response, the sum of the sizes of the component belief states will be larger than the size of the original belief sate (imperfect information)

  40. Information in Kriegspiel • In Kriegspiel, the only way we can learn about the opponent's pieces is through the referee’s responses (bolstered by our knowledge of the rules of the game and the locations of our own pieces) • Thus, before proceeding, we should analyze exactly what kinds of information we get from the referee, and see how the unary marginal belief state can handle these kinds of information

  41. Information in Kriegspiel • What kinds of information can we get from the referee? Our opponent ... • has/does not have some specific piece at some specific location • has/had a (unspecified) piece at a specific location • has at least one (unspecified) piece at some range of locations • has a piece attacking a specific space (sometimes from a specific direction) • has no unblocked piece attacking a specific space

  42. Information in Kriegspiel • Only the first of the five types of information can be captured by unary marginals • Thus, if possible we would like to amend this representation to capture a higher proportion of the information

  43. Amending the Belief State • The unary marginals store 16 bits for each square (incl. off-the-board) • Each bit stores whether a specific piece of Black’s could possibly be at this position • As a very simple refinement, simply store more bits per square to try to capture more information • A single bit can store whether or not a square is certainly occupied • Two more bits let us store whether a square is certainly/possibly/impossibly attacked by an opponent’s piece • Six more bits let us store whether a square is certainly occupied by an opponent’s piece that attacks in a certain direction (row/column or diagonal), or by a specific type of piece (knight, pawn, bishop, or rook)

  44. Amended Belief State • With the additions from the previous slide, the belief state can capture all but • has at least one (unspecified) piece at some range of locations • While the extra information will be useful in immediate reasoning, it is fairly transient

  45. Another Refinement • The unary marginals store, for each piece, what squares it could possibly occupy • This concept can be extended to the “binary marginals” by storing, for each pair of pieces, what pairs of squares they could possibly occupy • Among other things, this allows us to capture when Black’s pieces block one-another • However, this representation requires (65*16)2 bits to store, and still ignores many basic constraints • This can be extended up to 16-ary marginals, which are identical to the exact belief state.

  46. Some Problems • Although they seem like a reasonable approach, the “n-ary marginal belief states” are far from perfect: They admit … • Illegal board positions • Inconsistent positions (multiple pieces per square) • Positions where the opponent has the incorrect number of pieces • Positions where the opponent has made no moves at all, or all possible moves simultaneously

  47. Implementation of Unary Marginals • Currently, I am in the process of implementing the unary marginal belief state • Move generation and pruning based on the referee’s response can be accomplished fairly simply (with limited accuracy) • We only need to look at the possible locations of one or two pieces at a time • Unfortunately, this does not seem to be true of terminal test

  48. Terminal Test Issues • We are searching for certain checkmate • Thus, if the belief state at any point contains a stalemate position, we fail • However, detecting stalemate from unary marginals is difficult • Stalemate typically depends on the locations of all the pieces on the board • No algorithm (that I can think of) can exactly detect stalemate positions in a marginal belief state, without fully enumerating at least some of its positions

  49. Proposed Implementation • The best implementation I can come up with for terminal test is a depth first search on possible positions admitted by the belief state • With some intelligent pruning and ordering techniques, this will hopefully be tractable for belief states of moderate size.

More Related