Template:Short description Template:Use mdy dates
Combinatorial game theory measures game complexity in several ways:
- State-space complexity (the number of legal game positions from the initial position)
- Game tree size (total number of possible games)
- Decision complexity (number of leaf nodes in the smallest decision tree for initial position)
- Game-tree complexity (number of leaf nodes in the smallest full-width decision tree for initial position)
- Computational complexity (asymptotic difficulty of a game as it grows arbitrarily large)
These measures involve understanding the game positions, possible outcomes, and computational complexity of various game scenarios.
Measures of game complexityEdit
State-space complexityEdit
The state-space complexity of a game is the number of legal game positions reachable from the initial position of the game.<ref name="Allis1994"/>
When this is too hard to calculate, an upper bound can often be computed by also counting (some) illegal positions (positions that can never arise in the course of a game).
Game tree sizeEdit
The game tree size is the total number of possible games that can be played. This is the number of leaf nodes in the game tree rooted at the game's initial position.
The game tree is typically vastly larger than the state-space because the same positions can occur in many games by making moves in a different order (for example, in a tic-tac-toe game with two X and one O on the board, this position could have been reached in two different ways depending on where the first X was placed). An upper bound for the size of the game tree can sometimes be computed by simplifying the game in a way that only increases the size of the game tree (for example, by allowing illegal moves) until it becomes tractable.
For games where the number of moves is not limited (for example by the size of the board, or by a rule about repetition of position) the game tree is generally infinite.
Decision treesEdit
A decision tree is a subtree of the game tree, with each position labelled "player A wins", "player B wins", or "draw" if that position can be proved to have that value (assuming best play by both sides) by examining only other positions in the graph. Terminal positions can be labelled directly—with player A to move, a position can be labelled "player A wins" if any successor position is a win for A; "player B wins" if all successor positions are wins for B; or "draw" if all successor positions are either drawn or wins for B. (With player B to move, corresponding positions are marked similarly.)
The following two methods of measuring game complexity use decision trees:
Decision complexityEdit
Decision complexity of a game is the number of leaf nodes in the smallest decision tree that establishes the value of the initial position.
Game-tree complexityEdit
Game-tree complexity of a game is the number of leaf nodes in the smallest full-width decision tree that establishes the value of the initial position.<ref name="Allis1994"/> A full-width tree includes all nodes at each depth. This is an estimate of the number of positions one would have to evaluate in a minimax search to determine the value of the initial position.
It is hard even to estimate the game-tree complexity, but for some games an approximation can be given by <math>GTC \geq b^d</math>, where Template:Mvar is the game's average branching factor and Template:Mvar is the number of plies in an average game.
Computational complexityEdit
The computational complexity of a game describes the asymptotic difficulty of a game as it grows arbitrarily large, expressed in big O notation or as membership in a complexity class. This concept doesn't apply to particular games, but rather to games that have been generalized so they can be made arbitrarily large, typically by playing them on an n-by-n board. (From the point of view of computational complexity, a game on a fixed size of board is a finite problem that can be solved in O(1), for example by a look-up table from positions to the best move in each position.)
The asymptotic complexity is defined by the most efficient algorithm for solving the game (in terms of whatever computational resource one is considering). The most common complexity measure, computation time, is always lower-bounded by the logarithm of the asymptotic state-space complexity, since a solution algorithm must work for every possible state of the game. It will be upper-bounded by the complexity of any particular algorithm that works for the family of games. Similar remarks apply to the second-most commonly used complexity measure, the amount of space or computer memory used by the computation. It is not obvious that there is any lower bound on the space complexity for a typical game, because the algorithm need not store game states; however many games of interest are known to be PSPACE-hard, and it follows that their space complexity will be lower-bounded by the logarithm of the asymptotic state-space complexity as well (technically the bound is only a polynomial in this quantity; but it is usually known to be linear).
- The depth-first minimax strategy will use computation time proportional to the game's tree-complexity (since it must explore the whole tree), and an amount of memory polynomial in the logarithm of the tree-complexity (since the algorithm must always store one node of the tree at each possible move-depth, and the number of nodes at the highest move-depth is precisely the tree-complexity).
- Backward induction will use both memory and time proportional to the state-space complexity, as it must compute and record the correct move for each possible position.
Example: tic-tac-toe (noughts and crosses)Edit
For tic-tac-toe, a simple upper bound for the size of the state space is 39 = 19,683. (There are three states for each of the nine cells.) This count includes many illegal positions, such as a position with five crosses and no noughts, or a position in which both players have a row of three. A more careful count, removing these illegal positions, gives 5,478.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> And when rotations and reflections of positions are considered identical, there are only 765 essentially different positions.
To bound the game tree, there are 9 possible initial moves, 8 possible responses, and so on, so that there are at most 9! or 362,880 total games. However, games may take less than 9 moves to resolve, and an exact enumeration gives 255,168 possible games. When rotations and reflections of positions are considered the same, there are only 26,830 possible games.
The computational complexity of tic-tac-toe depends on how it is generalized. A natural generalization is to m,n,k-games: played on an m by n board with winner being the first player to get k in a row. This game can be solved in DSPACE(mn) by searching the entire game tree. This places it in the important complexity class PSPACE; with more work, it can be shown to be PSPACE-complete.<ref name="Reisch1980b">Template:Cite journal</ref>
Complexities of some well-known gamesEdit
Due to the large size of game complexities, this table gives the ceiling of their logarithm to base 10. (In other words, the number of digits). All of the following numbers should be considered with caution: seemingly minor changes to the rules of a game can change the numbers (which are often rough estimates anyway) by tremendous factors, which might easily be much greater than the numbers shown.
Game | Board size
(positions) |
State-space complexity
(as log to base 10) |
Game-tree complexity
(as log to base 10) |
Average game length
(plies) |
Branching factor | Ref | Complexity class of suitable generalized game | |||
---|---|---|---|---|---|---|---|---|---|---|
Tic-tac-toe | 9 | 3 | 5 | 9 | 4 | PSPACE-complete<ref name="Reisch1980"/> | ||||
Sim | 15 | 3 | 8 | 14 | 3.7 | PSPACE-complete<ref>Template:Cite conference</ref> | ||||
Pentominoes | 64 | 12 | 18 | 10 | 75 | <ref name="GamesSolved"/><ref>Template:Cite conference</ref> | Template:Dunno, but in PSPACE | |||
Kalah<ref>See van den Herik et al for rules.</ref> | 14 | 13 | 18 | 50 | <ref name="GamesSolved"/> | Generalization is unclear | ||||
Connect Four | 42 | 13 | 21 | 36 | 4 | <ref name="Allis1994"/><ref>{{#invoke:citation/CS1|citation | CitationClass=web
}}</ref> |
Template:Dunno, but in PSPACE | ||
Domineering (8 × 8) | 64 | 15 | 27 | 30 | 8 | <ref name="GamesSolved"/> | Template:Dunno, but in PSPACE; in P for certain dimensions<ref>Template:Cite conference</ref> | |||
Congkak | 14 | 15 | 33 | <ref name="GamesSolved">Template:Cite journal</ref> | ||||||
English draughts (8x8) (checkers) | 32 | 20 or 18 | 40 | 70 | 2.8 | <ref name="Allis1994"/><ref>Template:Cite journal</ref><ref>Template:Cite journal</ref> | EXPTIME-complete<ref name="robson1984">Template:Cite journal</ref> | |||
Awari<ref>See Allis 1994 for rules</ref> | 12 | 12 | 32 | 60 | 3.5 | <ref name="Allis1994"/> | Generalization is unclear | |||
Qubic | 64 | 30 | 34 | 20 | 54.2 | <ref name=Allis1994/> | PSPACE-complete<ref name="Reisch1980"/> | |||
Double dummy bridgeTemplate:Refn | (52) | <17 | <40 | 52 | 5.6 | PSPACE-complete<ref>Template:Cite conference</ref> | ||||
Fanorona | 45 | 21 | 46 | 44 | 11 | <ref name="Schadd2008">Template:Cite journal</ref> | Template:Dunno, but in EXPTIME | |||
Nine men's morris | 24 | 10 | 50 | 50 | 10 | <ref name="Allis1994"/> | Template:Dunno, but in EXPTIME | |||
Tablut | 81 | 27 | <ref name="Galassi2018">{{#invoke:citation/CS1|citation | CitationClass=web
}}</ref> |
||||||
International draughts (10x10) | 50 | 30 | 54 | 90 | 4 | <ref name="Allis1994"/> | EXPTIME-complete<ref name="robson1984"/> | |||
Chinese checkers (2 sets) | 121 | 23 | 180 | <ref name=Bell_Halma>Template:Cite journal</ref> | EXPTIME-complete<ref name=pebble>Template:Cite journal Proves completeness of the generalization to arbitrary graphs.</ref> | |||||
Chinese checkers (6 sets) | 121 | 78 | 600 | <ref name=Bell_Halma/> | EXPTIME-complete<ref name=pebble/> | |||||
Reversi (Othello) | 64 | 28 | 58 | 58 | 10 | <ref name="Allis1994"/> | PSPACE-complete<ref>Template:Cite journal</ref> | |||
OnTop (2p base game) | 72 | 88 | 62 | 31 | 23.77 | <ref name="OnTopComputer">Template:Cite thesis</ref> | ||||
Lines of Action | 64 | 23 | 64 | 44 | 29 | <ref name="Winands2004">Template:Cite thesis</ref> | Template:Dunno, but in EXPTIME | |||
Gomoku (15x15, freestyle) | 225 | 105 | 70 | 30 | 210 | <ref name="Allis1994"/> | PSPACE-complete<ref name="Reisch1980"/> | |||
Hex (11x11) | 121 | 57 | 98 | 50 | 96 | <ref name="GamesSolved"/> | PSPACE-complete<ref name="Reisch1980">Template:Cite journal</ref> | |||
Chess | 64 | 44 | 123 | 70 | 35 | <ref name="Shannon1950">The size of the state space and game tree for chess were first estimated in Template:Cite journal Shannon gave estimates of 1043 and 10120 respectively, smaller than the upper bound in the table,
which is detailed in Shannon number.</ref> |
EXPTIME-complete (without 50-move drawing rule)<ref name="Fraenkel1981">Template:Cite journal</ref> | |||
Bejeweled and Candy Crush (8x8) | 64 | <50 | 70 | <ref name="Gual14">Template:Cite conference</ref> | NP-hard | |||||
GIPF | 37 | 25 | 132 | 90 | 29.3 | <ref name="Wentink_thesis">Template:Cite thesis</ref> | ||||
Connect6 | 361 | 172 | 140 | 30 | 46000 | <ref name=EnhancePNConn6>Template:Cite book</ref> | PSPACE-complete<ref>Template:Cite journal</ref> | |||
Backgammon | 28 | 20 | 144 | 55 | 250 | <ref>Template:Cite journal</ref> | Generalization is unclear | |||
Xiangqi | 90 | 40 | 150 | 95 | 38 | <ref name="Allis1994">Template:Cite thesis</ref><ref name="Hsu2004">Template:Cite journal</ref><ref name="Donghwi">Template:Cite arXiv</ref> | Template:Dunno, believed to be EXPTIME-complete | |||
Abalone | 61 | 25 | 154 | 87 | 60 | <ref name=PasChor>{{#invoke:citation/CS1|citation | CitationClass=web
}}</ref><ref name=Kopczynski>Template:Cite thesis</ref> |
PSPACE-hard, and in EXPTIME | ||
Havannah | 271 | 127 | 157 | 66 | 240 | <ref name="GamesSolved"/><ref>{{#invoke:citation/CS1|citation | CitationClass=web
}}</ref> |
PSPACE-complete<ref>Template:Cite arXiv</ref> | ||
Twixt | 572 | 140 | 159 | 60 | 452 | <ref name="Thesis_Moesker">Template:Cite thesis</ref> | ||||
Janggi | 90 | 44 | 160 | 100 | 40 | <ref name="Donghwi"/> | Template:Dunno, believed to be EXPTIME-complete | |||
Quoridor | 81 | 42 | 162 | 91 | 60 | <ref name=MasterQuor>Template:Cite thesis</ref> | Template:Dunno, but in PSPACE | |||
Carcassonne (2p base game) | 72 | >40 | 195 | 71 | 55 | <ref name="CarcassoneComputer">Template:Cite thesis</ref> | Generalization is unclear | |||
Amazons (10x10) | 100 | 40 | 212 | 84 | 374 or 299<ref>The lower branching factor is for the second player.</ref> | <ref name="Kloetzer_themonte-carlo">Template:Cite conference</ref><ref name="Hengens_thesis">{{#invoke:citation/CS1|citation | CitationClass=web
}}</ref> |
PSPACE-complete<ref>Template:Cite arXiv</ref> | ||
Shogi | 81 | 71 | 226 | 115 | 92 | <ref name="Hsu2004"/><ref>Template:Cite journal</ref> | EXPTIME-complete<ref>Template:Cite journal</ref> | |||
Thurn and Taxis (2 player) | 33 | 66 | 240 | 56 | 879 | <ref name="Schadd2010">Template:Cite thesis</ref> | ||||
Go (19x19) | 361 | 170 | 505 | 211 | 250 | <ref name="Allis1994"/><ref name="cwi">{{#invoke:citation/CS1|citation | CitationClass=web
}} This paper derives the bounds 48<log(log(N))<171 on the number of possible games N.</ref><ref name="Tromp2016">{{#invoke:citation/CS1|citation |
CitationClass=web
}}</ref> <ref>{{#invoke:citation/CS1|citation |
CitationClass=web
}}</ref> |
EXPTIME-complete (without the superko rule)<ref name="Robson1983">Template:Cite book</ref> |
Arimaa | 64 | 43 | 402 | 92 | 17281 | <ref name="Cox2006">{{#invoke:citation/CS1|citation | CitationClass=web
}}</ref><ref name="Wu2011">{{#invoke:citation/CS1|citation |
CitationClass=web
}}</ref><ref name="Haskin2006">{{#invoke:citation/CS1|citation |
CitationClass=web
}}</ref> |
Template:Dunno, but in EXPTIME |
Stratego | 92 | 115 | 535 | 381 | 21.739 | <ref name="ArtsStratego">Template:Cite thesis</ref> | ||||
Infinite chess | infinite | infinite | infinite | infinite | infinite | <ref>Template:Cite arXiv</ref> | Template:Unknown, but mate-in-n is decidable<ref name="Brumleve2012">Template:Cite journal</ref> | |||
Magic: The Gathering | <ref name="Churchill2020">Template:Cite arXiv</ref> | AH-hard<ref name="Biderman">Template:Cite arXiv</ref> | ||||||||
Wordle | 5 | 4.113 (12,972) | 6 | <ref>Template:Cite arXiv</ref> | NP-hard, unknown if PSPACE-complete with parametization |
NotesEdit
ReferencesEdit
See alsoEdit
- Go and mathematics
- Solved game
- Solving chess
- Shannon number
- list of NP-complete games and puzzles
- list of PSPACE-complete games and puzzles