Game complexity explained

Combinatorial game theory measures game complexity in several ways:

  1. State-space complexity (the number of legal game positions from the initial position),
  2. Game tree size (total number of possible games),
  3. Decision complexity (number of leaf nodes in the smallest decision tree for initial position),
  4. Game-tree complexity (number of leaf nodes in the smallest full-width decision tree for initial position),
  5. 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.

When this is too hard to calculate, an upper bound can often be computed by also counting (some) illegal positions, meaning positions that can never arise in the course of a game.

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. 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 branching factor b to the power of the number of plies d in an average game, or:

GTC\geqbd

.

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 computational resource one is considering) algorithm for solving the game; 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).

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.[1] [2] 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.[3]

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

See also

External links

Notes and References

  1. Web site: combinatorics - TicTacToe State Space Choose Calculation. Mathematics Stack Exchange. 2020-04-08.
  2. Web site: T. Brian. Btsan/generate_tictactoe. . 2018-10-20. 2020-04-08.
  3. Stefan Reisch . Gobang ist PSPACE-vollständig (Gobang is PSPACE-complete) . Acta Informatica . 13 . 1 . 59–66 . 1980 . 10.1007/bf00288536. 21455572.
  4. Slany . Wolfgang . Marsland . T. Anthony . Frank . Ian . The complexity of graph Ramsey games . 10.1007/3-540-45579-5_12 . 186–203 . Springer . Lecture Notes in Computer Science . Computers and Games, Second International Conference, CG 2000, Hamamatsu, Japan, October 26-28, 2000, Revised Papers . 2063 . 2000.
  5. Orman . Hilarie K. . Nowakowski . Richard J. . Pentominoes: a first player win . https://www.msri.org/publications/books/Book29/files/orman.pdf . 0-521-57411-0 . 1427975 . 339–344 . Cambridge University Press . Mathematical Sciences Research Institute Publications . Games of No Chance: Papers from the Combinatorial Games Workshop held in Berkeley, CA, July 11–21, 1994 . 29 . 1996.
  6. See van den Herik et al for rules.
  7. Web site: John's Connect Four Playground . John Tromp . 2010 .
  8. Lachmann . Michael . Moore . Cristopher . Rapaport . Ivan . Nowakowski . Richard . Who wins Domineering on rectangular boards? . 0-521-80832-4 . 1973019 . 307–315 . Cambridge University Press . Mathematical Sciences Research Institute Publications . More Games of No Chance: Proceedings of the 2nd Combinatorial Games Theory Workshop held in Berkeley, CA, July 24–28, 2000 . 42 . 2002.
  9. Games solved: Now and in the future . H. J. van den Herik . J. W. H. M. Uiterwijk . J. van Rijswijck . 2002 . Artificial Intelligence . 134 . 1–2 . 277–311 . 10.1016/S0004-3702(01)00152-7. free .
  10. Jonathan Schaeffer. Checkers is Solved . Science . July 6, 2007 . 10.1126/science.1144079 . 317 . 5844 . 1518–1522 . 17641166 . etal. 2007Sci...317.1518S . 10274228 . free .
  11. Schaeffer . Jonathan . 10.3233/ICG-2007-30402 . 4 . . 187–197 . Game over: Black to play and draw in checkers . https://web.archive.org/web/20160403093928/https://ticc.uvt.nl/icga/journal/contents/Schaeffer07-01-08.pdf . 2016-04-03 . dead . 30 . 2007.
  12. J. M. Robson . N by N checkers is Exptime complete . . 13 . 2 . 252–267 . 1984 . 10.1137/0213018.
  13. See Allis 1994 for rules
  14. Bonnet . Edouard . Jamain . Florian . Saffidine . Abdallah . Rossi . Francesca . On the complexity of trick-taking card games . https://www.aaai.org/ocs/index.php/IJCAI/IJCAI13/paper/view/6920 . 482–488 . IJCAI/AAAI . IJCAI 2013, Proceedings of the 23rd International Joint Conference on Artificial Intelligence, Beijing, China, August 3-9, 2013 . 2013.
  15. M.P.D. Schadd . M.H.M. Winands . J.W.H.M. Uiterwijk . H.J. van den Herik . M.H.J. Bergsma . 2008 . Best Play in Fanorona leads to Draw . . 4 . 3 . 369–387. 10.1142/S1793005708001124.
  16. Web site: Andrea Galassi . An Upper Bound on the Complexity of Tablut . 2018 .
  17. G.I. Bell. The Shortest Game of Chinese Checkers and Related Problems. Integers. 2009. 9. 10.1515/INTEG.2009.003. 0803.1245. 2008arXiv0803.1245B. 17141575.
  18. Kasai . Takumi . Adachi . Akeo . Iwata . Shigeki . 10.1137/0208046 . 4 . SIAM Journal on Computing . 573848 . 574–586 . Classes of pebble games and complete problems . 8 . 1979. Proves completeness of the generalization to arbitrary graphs.
  19. Iwata . Shigeki . Kasai . Takumi . 10.1016/0304-3975(94)90131-7 . free . 2 . Theoretical Computer Science . 1256205 . 329–340 . The Othello game on an

    n x n

    board is PSPACE-complete . 123 . 1994.
  20. Analysis and Implementation of the Game OnTop . Robert Briesemeister . 2009 . Maastricht University, Dept of Knowledge Engineering .
  21. Mark H.M. Winands . 2004 . Informed Search in Complex Games . Ph.D. . Maastricht University, Maastricht, The Netherlands . 90-5278-429-9 .
  22. Stefan Reisch . Hex ist PSPACE-vollständig (Hex is PSPACE-complete) . Acta Inform . 15 . 1981 . 167–191.
  23. The size of the state space and game tree for chess were first estimated in Claude Shannon . Claude Shannon . Programming a Computer for Playing Chess . Philosophical Magazine . 41 . 314 . 1950 . dead . https://web.archive.org/web/20100706211229/http://archive.computerhistory.org/projects/chess/related_materials/text/2-0%20and%202-1.Programming_a_computer_for_playing_chess.shannon/2-0%20and%202-1.Programming_a_computer_for_playing_chess.shannon.062303002.pdf . 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.
  24. Fraenkel . Aviezri S. . Aviezri Fraenkel . Lichtenstein . David . 10.1016/0097-3165(81)90016-9 . free . 2 . . 629595 . 199–214 . Computing a perfect strategy for

    n x n

    chess requires time exponential in

    n

    . 31 . 1981.
  25. Gualà . Luciano . Leucci . Stefano . Natale . Emanuele . 1403.5830 . Bejeweled, Candy Crush and other match-three games are (NP-)hard . 10.1109/CIG.2014.6932866 . 1–8 . IEEE . 2014 IEEE Conference on Computational Intelligence and Games, CIG 2014, Dortmund, Germany, August 26-29, 2014 . 2014.
  26. Analysis and Implementation of the game Gipf . Diederik Wentink . 2001 . Maastricht University.
  27. Book: 2009 Chinese Control and Decision Conference . 10.1109/CCDC.2009.5191963 . Enhancements of proof number search in connect6 . 2009 . Chang-Ming Xu . Ma . Z.M. . Jun-Jie Tao . Xin-He Xu . 978-1-4244-2722-2 . 4525 . 20960281 .
  28. On the fairness and complexity of generalized k -in-a-row games. Ming Yu. Hsieh. Shi-Chun. Tsai. 1 October 2007. Theoretical Computer Science. 385. 1–3. 88–100. 12 April 2018. dl.acm.org. 10.1016/j.tcs.2007.05.031. free.
  29. Practical issues in temporal difference learning. Gerald. Tesauro. 1 May 1992. Machine Learning. 8. 3–4. 257–277. 10.1007/BF00992697. free.
  30. Victor Allis . Victor Allis . 1994 . Searching for Solutions in Games and Artificial Intelligence . Ph.D. . University of Limburg, Maastricht, The Netherlands . 90-900748-8-0 .
  31. Shi-Jim Yen, Jr-Chang Chen . Tai-Ning Yang . Shun-Chin Hsu . Computer Chinese Chess . March 2004 . International Computer Games Association Journal . 27 . 1 . 3–18 . dead . https://web.archive.org/web/20070614111609/http://www.csie.ndhu.edu.tw/~sjyen/Papers/2004CCC.pdf . 2007-06-14 . 10.3233/ICG-2004-27102 . 10336286 .
  32. Donghwi Park . Space-state complexity of Korean chess and Chinese chess . 1507.06401. 2015. math.GM .
  33. Web site: Chorus. Pascal. Implementing a Computer Player for Abalone Using Alpha-Beta and Monte-Carlo Search. Dept of Knowledge Engineering, Maastricht University. 29 March 2012.
  34. Jacob S . Kopczynski . Pushy Computing: Complexity Theory and the Game Abalone . Reed College . 2014.
  35. Web site: Joosten. B. Creating a Havannah Playing Agent. 29 March 2012.
  36. E. Bonnet . F. Jamain . A. Saffidine . Havannah and TwixT are PSPACE-complete . 2014-03-25 . 1403.6518 . cs.CC.
  37. Txixt: Theory, Analysis, and Implementation . Kevin Moesker . 2009 . Faculty of Humanities and Sciences of Maastricht University .
  38. Lisa Glendenning . Mastering Quoridor . May 2005 . Computer Science . B.Sc. . . dead . https://web.archive.org/web/20120315192840/http://hyperion.cs.washington.edu/attachments/15/glendenning_ugrad_thesis.pdf . 2012-03-15 .
  39. Implementing a Computer Player for Carcassonne . Cathleen Heyden . 2009 . Maastricht University, Dept of Knowledge Engineering .
  40. The lower branching factor is for the second player.
  41. Kloetzer . Julien . Iida . Hiroyuki . Bouzy . Bruno . The Monte-Carlo approach in Amazons . https://helios2.mi.parisdescartes.fr/~Bouzy/publications/KIB-MCAmazons-CGW07.pdf . 185–192 . Computer Games Workshop, Amsterdam, the Netherlands, 15-17 June 2007 . 2007.
  42. Web site: P. P. L. M. Hensgens . A Knowledge-Based Approach of the Game of Amazons . 2001 . Universiteit Maastricht, Institute for Knowledge and Agent Technology .
  43. R. A. Hearn . Amazons is PSPACE-complete . 2005-02-02 . cs.CC/0502013 .
  44. Computer shogi . 10.1016/S0004-3702(01)00157-6 . Artificial Intelligence . 134 . 1–2 . January 2002 . 121–144 . Hiroyuki Iida . Makoto Sakuta . Jeff Rollason . free .
  45. H. Adachi . H. Kamekawa . S. Iwata . Shogi on n × n board is complete in exponential time . Trans. IEICE . J70-D . 1843–1852 . 1987.
  46. F.C. Schadd . Monte-Carlo Search Techniques in the Modern Board Game Thurn and Taxis . 2009 . Maastricht University. https://web.archive.org/web/20210114164554/https://project.dke.maastrichtuniversity.nl/games/files/msc/Fschadd_thesis.pdf . 2021-01-14 .
  47. Web site: Combinatorics of Go . John Tromp . Gunnar Farnebäck . 2007 . This paper derives the bounds 48<log(log(N))<171 on the number of possible games N.
  48. Web site: Number of legal Go positions . John Tromp . 2016 .
  49. Book: J. M. Robson . The complexity of Go . Information Processing; Proceedings of IFIP Congress . 1983 . 413–417.
  50. Web site: Analysis and Implementation of the Game Arimaa . Christ-Jan Cox . 2006 .
  51. Web site: Move Ranking and Evaluation in the Game of Arimaa . David Jian Wu . 2011 .
  52. Web site: A Look at the Arimaa Branching Factor . Brian Haskin . 2006 .
  53. A.F.C. Arts . Competitive Play in Stratego . 2010 . Maastricht .
  54. CDA Evans and Joel David Hamkins . Transfinite game values in infinite chess . 2014. math.LO . 1302.4377 .
  55. Stefan Reisch, Joel David Hamkins, and Phillipp Schlicht . The mate-in-n problem of infinite chess is decidable . Conference on Computability in Europe . 2012 . 78–88 . 1201.5597 .
  56. Alex Churchill, Stella Biderman, and Austin Herrick . Magic: the Gathering is Turing Complete . 2020 . cs.AI . 1904.09828 .
  57. Stella Biderman . Magic: the Gathering is as Hard as Arithmetic . 2020 . cs.AI . 2003.05119.
  58. Lokshtanov . Daniel . Subercaseaux . Bernardo . 2022-05-14 . Wordle is NP-hard . cs.CC . 2203.16713 .