Game complexity
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 game positions, possible outcomes, and computation required for various game scenarios.
Measures of game complexity
State-space complexity
The state-space complexity of a game is the number of legal game positions reachable from the initial position of the game.[1]
When this is too hard to calculate, an
Game tree size
The game tree size is the total number of possible games that can be played: 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 trees
The next two measures use the idea of a decision tree, which is a subtree of the game tree, with each position labelled with "player A wins", "player B wins" or "drawn", 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; a position with player A to move can be labelled "player A wins" if any successor position is a win for A, or labelled "player B wins" if all successor positions are wins for B, or labelled "draw" if all successor positions are either drawn or wins for B. And correspondingly for positions with B to move.)
Decision complexity
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 complexity
The 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.[1] 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 raising the game's average
.
Computational complexity
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 (in terms of whatever
- The computation timeproportional to 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)
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 cell and 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.[2][3] 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. It is immediately clear that this game can be solved in DSPACE(mn) by searching the entire game tree. This places it in the important complexity class PSPACE. With some more work it can be shown to be PSPACE-complete.[4]
Complexities of some well-known games
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.
Note: ordered by game tree size
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[5] | |
Sim
|
15 | 3 | 8 | 14 | 3.7 | PSPACE-complete[6] | |
Pentominoes | 64 | 12 | 18 | 10 | 75 | [7][8] | ?, but in PSPACE |
Kalah[9] | 14 | 13 | 18 | 50 | [7] | Generalization is unclear | |
Connect Four | 42 | 13 | 21 | 36 | 4 | [1][10] | ?, but in PSPACE |
Domineering (8 × 8) | 64 | 15 | 27 | 30 | 8 | [7] | ?, but in P for certain dimensions[11]
|
Congkak
|
14 | 15 | 33 | [7] | |||
English draughts (8x8) (checkers) | 32 | 20 or 18 | 40 | 70 | 2.8 | [1][12][13] | EXPTIME-complete[14]
|
Awari[15] | 12 | 12 | 32 | 60 | 3.5 | [1] | Generalization is unclear |
Qubic
|
64 | 30 | 34 | 20 | 54.2 | [1] | PSPACE-complete[5] |
Double dummy bridge[nb 1] | (52) | <17 | <40 | 52 | 5.6 | PSPACE-complete[16] | |
Fanorona | 45 | 21 | 46 | 44 | 11 | [17] | ?, but in EXPTIME |
Nine men's morris | 24 | 10 | 50 | 50 | 10 | [1] | ?, but in EXPTIME |
Tablut
|
81 | 27 | [18] | ||||
International draughts (10x10) | 50 | 30 | 54 | 90 | 4 | [1] | EXPTIME-complete[14]
|
Chinese checkers (2 sets) | 121 | 23 | 180 | [19] | EXPTIME-complete [20] | ||
Chinese checkers (6 sets) | 121 | 78 | 600 | [19] | EXPTIME-complete [20] | ||
Reversi (Othello) | 64 | 28 | 58 | 58 | 10 | [1] | PSPACE-complete[21] |
OnTop (2p base game) | 72 | 88 | 62 | 31 | 23.77 | [22] | |
Lines of Action | 64 | 23 | 64 | 44 | 29 | [23] | ?, but in EXPTIME |
Gomoku (15x15, freestyle) | 225 | 105 | 70 | 30 | 210 | [1] | PSPACE-complete[5] |
Hex (11x11) | 121 | 57 | 98 | 50 | 96 | [7] | PSPACE-complete[5] |
Chess | 64 | 44 | 123 | 70 | 35 | [24] | EXPTIME-complete (without 50-move drawing rule)[25]
|
Bejeweled and Candy Crush (8x8) | 64 | <50 | 70 | [26] | NP-hard
| ||
GIPF | 37 | 25 | 132 | 90 | 29.3 | [27] | |
Connect6 | 361 | 172 | 140 | 30 | 46000 | [28] | PSPACE-complete[29] |
Backgammon | 28 | 20 | 144 | 55 | 250 | [30] | Generalization is unclear |
Xiangqi | 90 | 40 | 150 | 95 | 38 | [1][31][32] | ?, believed to be EXPTIME-complete
|
Abalone | 61 | 25 | 154 | 87 | 60 | [33][34] | PSPACE-hard, and in EXPTIME
|
Havannah | 271 | 127 | 157 | 66 | 240 | [7][35] | PSPACE-complete[36] |
Twixt | 572 | 140 | 159 | 60 | 452 | [37] | |
Janggi | 90 | 44 | 160 | 100 | 40 | [32] | ?, believed to be EXPTIME-complete
|
Quoridor | 81 | 42 | 162 | 91 | 60 | [38] | ?, but in PSPACE |
Carcassonne (2p base game) | 72 | >40 | 195 | 71 | 55 | [39] | Generalization is unclear |
Amazons (10x10) | 100 | 40 | 212 | 84 | 374 or 299[40] | [41][42] | PSPACE-complete[43] |
Shogi | 81 | 71 | 226 | 115 | 92 | [31][44] | EXPTIME-complete[45]
|
Thurn and Taxis (2 player) | 33 | 66 | 240 | 56 | 879 | [46] | |
Go (19x19) | 361 | 170 | 360 | 150 | 250 | [1][47][48] | superko rule)[49]
|
Arimaa | 64 | 43 | 402 | 92 | 17281 | [50][51][52] | ?, but in EXPTIME |
Stratego | 92 | 115 | 535 | 381 | 21.739 | [53] | |
Infinite chess | infinite | infinite | infinite | infinite | infinite | [54] | Unknown, but mate-in-n is decidable[55] |
Magic: The Gathering | [56] | AH-hard[57] | |||||
Wordle | 5 | 12,972 | 6 | [58] | NP-hard, unknown if PSPACE-complete with parametization. |
Notes
- ^ Double dummy bridge (i.e., double dummy problems in the context of contract bridge) is not a proper board game but has a similar game tree, and is studied in computer bridge. The bridge table can be regarded as having one slot for each player and trick to play a card in, which corresponds to board size 52. Game-tree complexity is a very weak upper bound: 13! to the power of 4 players regardless of legality. State-space complexity is for one given deal; likewise regardless of legality but with many transpositions eliminated. The last 4 plies are always forced moves with branching factor 1.
References
- ^ ISBN 90-900748-8-0.
- ^ "combinatorics - TicTacToe State Space Choose Calculation". Mathematics Stack Exchange. Retrieved 2020-04-08.
- ^ T, Brian (October 20, 2018). "Btsan/generate_tictactoe". GitHub. Retrieved 2020-04-08.
- S2CID 21455572.
- ^ a b c d Stefan Reisch (1981). "Hex ist PSPACE-vollständig (Hex is PSPACE-complete)". Acta Inform (15): 167–191.
- .
- ^ .
- MR 1427975.
- ^ See van den Herik et al for rules.
- ^ John Tromp (2010). "John's Connect Four Playground".
- MR 1973019.
- S2CID 10274228.
- doi:10.3233/ICG-2007-30402. Archived from the original(PDF) on 2016-04-03.
- ^ doi:10.1137/0213018.
- ^ See Allis 1994 for rules
- ^ Bonnet, Edouard; Jamain, Florian; Saffidine, Abdallah (2013). "On the complexity of trick-taking card games". In Rossi, Francesca (ed.). IJCAI 2013, Proceedings of the 23rd International Joint Conference on Artificial Intelligence, Beijing, China, August 3-9, 2013. IJCAI/AAAI. pp. 482–488.
- .
- ^ Andrea Galassi (2018). "An Upper Bound on the Complexity of Tablut".
- ^ S2CID 17141575.
- ^ MR 0573848. Proves completeness of the generalization to arbitrary graphs.
- ^ Iwata, Shigeki; Kasai, Takumi (1994). "The Othello game on an board is PSPACE-complete". Theoretical Computer Science. 123 (2): 329–340. MR 1256205.
- ^ Robert Briesemeister (2009). Analysis and Implementation of the Game OnTop (PDF) (Thesis). Maastricht University, Dept of Knowledge Engineering.
- ISBN 90-5278-429-9.
- ^ The size of the state space and game tree for chess were first estimated in Claude Shannon (1950). "Programming a Computer for Playing Chess" (PDF). Philosophical Magazine. 41 (314). Archived from the original (PDF) on 2010-07-06. Shannon gave estimates of 1043 and 10120 respectively, smaller than the upper bound in the table, which is detailed in Shannon number.
- ^ Fraenkel, Aviezri S.; Lichtenstein, David (1981). "Computing a perfect strategy for chess requires time exponential in ". MR 0629595.
- .
- ^ Diederik Wentink (2001). Analysis and Implementation of the game Gipf (PDF) (Thesis). Maastricht University.
- S2CID 20960281.
- . Retrieved 2018-04-12 – via dl.acm.org.
- .
- ^ S2CID 10336286. Archived from the original(PDF) on 2007-06-14.
- ^ arXiv:1507.06401 [math.GM].
- ^ Chorus, Pascal. "Implementing a Computer Player for Abalone Using Alpha-Beta and Monte-Carlo Search" (PDF). Dept of Knowledge Engineering, Maastricht University. Retrieved 2012-03-29.
- ^ Kopczynski, Jacob S (2014). Pushy Computing: Complexity Theory and the Game Abalone (Thesis). Reed College.
- ^ Joosten, B. "Creating a Havannah Playing Agent" (PDF). Retrieved 2012-03-29.
- ].
- ^ Kevin Moesker (2009). Txixt: Theory, Analysis, and Implementation (PDF) (Thesis). Faculty of Humanities and Sciences of Maastricht University.
- ^ Lisa Glendenning (May 2005). Mastering Quoridor (PDF). Computer Science (B.Sc. thesis). University of New Mexico. Archived from the original (PDF) on 2012-03-15.
- ^ Cathleen Heyden (2009). Implementing a Computer Player for Carcassonne (PDF) (Thesis). Maastricht University, Dept of Knowledge Engineering.
- ^ The lower branching factor is for the second player.
- ^ Kloetzer, Julien; Iida, Hiroyuki; Bouzy, Bruno (2007). "The Monte-Carlo approach in Amazons" (PDF). Computer Games Workshop, Amsterdam, the Netherlands, 15-17 June 2007. pp. 185–192.
- ^ P. P. L. M. Hensgens (2001). "A Knowledge-Based Approach of the Game of Amazons" (PDF). Universiteit Maastricht, Institute for Knowledge and Agent Technology.
- arXiv:cs.CC/0502013.
- .
- ^ H. Adachi; H. Kamekawa; S. Iwata (1987). "Shogi on n × n board is complete in exponential time". Trans. IEICE. J70-D: 1843–1852.
- ^ F.C. Schadd (2009). Monte-Carlo Search Techniques in the Modern Board Game Thurn and Taxis (PDF) (Thesis). Maastricht University. Archived from the original (PDF) on 2021-01-14.
- ^ John Tromp; Gunnar Farnebäck (2007). "Combinatorics of Go". This paper derives the bounds 48<log(log(N))<171 on the number of possible games N.
- ^ John Tromp (2016). "Number of legal Go positions".
- ^ J. M. Robson (1983). "The complexity of Go". Information Processing; Proceedings of IFIP Congress. pp. 413–417.
- ^ Christ-Jan Cox (2006). "Analysis and Implementation of the Game Arimaa" (PDF).
- ^ David Jian Wu (2011). "Move Ranking and Evaluation in the Game of Arimaa" (PDF).
- ^ Brian Haskin (2006). "A Look at the Arimaa Branching Factor".
- ^ A.F.C. Arts (2010). Competitive Play in Stratego (PDF) (Thesis). Maastricht.
- ].
- arXiv:1201.5597.)
{{cite journal}}
: CS1 maint: multiple names: authors list (link - )
- arXiv:2003.05119 [cs.AI].
- arXiv:2203.16713 [cs.CC].
See also
- Go and mathematics
- Solved game
- Solving chess
- Shannon number
- list of NP-complete games and puzzles
- list of PSPACE-complete games and puzzles