Game complexity

From Wikipedia, the free encyclopedia

Go is considered to be the most complex board game.
Go is considered to be the most complex board game.

Combinatorial game theory has several ways of measuring game complexity. This article describes five of them: state-space complexity, game tree size, decision complexity, game-tree complexity, and computational complexity.

Contents

[edit] Measures of game 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 upper bound can often be computed by including illegal positions or positions that can never arise in the course of a game.

  • The game tree size is the total number of possible games that can be played: it's 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.

    However, 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 infinite.

The next two measures use the idea of a decision tree. A decision tree 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.)

  • The decision complexity of a game is the number of leaf nodes in the smallest decision tree that establishes the value of the initial position. Such a tree includes all possible decisions for the player to move second, but only one possibility for each decision for the player who starts the game.
  • 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 we would have to evaluate in a minimax search to determine the value of the initial position.

    It's hard even to estimate the game-tree complexity, but for some games a reasonable lower bound can be given by raising the game's average branching factor to the power of the number of plies in an average game.

  • 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.)

[edit] Example: tic-tac-toe

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. And when rotations and reflections of positions are considered identical, there are only 765 essentially different positions.

A simple upper bound for the size of the game tree is 9! = 362,880. (There are nine positions for the first move, eight for the second, and so on.) This includes illegal games that continue after one side has won. A more careful count 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.[2]

[edit] 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. 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

(cells)

State-space complexity

(as log to base 10)

Game-tree complexity

(as log to base 10)

Average game length

(plies)

Complexity class of suitable generalized game
Tic-tac-toe 9 3 5 9 PSPACE-complete[2]
Pentominoes 64 12 18 10 [3] ?, but in PSPACE
Connect Four 42 14[1] 21[1] 36[1] ?, but in PSPACE
English draughts (8x8) 32 20[4] or 18[1] 31[1] 70[1] EXPTIME-complete[5]
Oware[6] 12 12[1] 32[1] 60[1] Generalization is unclear
Qubic 64 30[1] 34[1] 20[1] PSPACE-complete[2]
Fanorona 45 21 [7] 46 [7] 22 ?, but in EXPTIME
Nine Men's Morris 24 10[1] 50[1] ? ?, but in EXPTIME
International draughts (10x10) 50 30?[1] 54[1] 90[1] EXPTIME-complete[5]
Chinese checkers (2 sets) 121 23 ? ? ?, but in EXPTIME
Chinese checkers (6 sets) 121 35 ? ? ?, but in EXPTIME
Lines of Action 64 24 56 63 ?, but in EXPTIME
Reversi 64 28[1] 58[1] 58[1] PSPACE-complete[8]
Hex (11x11) 121 56 ? 40 PSPACE-complete[9]
Gomoku (15x15, freestyle) 225 105?[1] 70[1] 30[1] PSPACE-complete[2]
Chess 64 50[10] 123[10] 80 EXPTIME-complete[11]
Connect6 361 172 70 or 140 15 or 30 PSPACE-complete[12]
Backgammon 28 20 144 50-60[13] Generalization is unclear
Xiangqi 90 48[1] 150[1] 80? ?, believed to be EXPTIME-complete
Quoridor 81 42 162 ? ?, but in PSPACE
Amazons (10x10) 100 40 (upper bound) ? ? PSPACE-complete[14]
Shogi 81 71[15] 226[15] 110? EXPTIME-complete[16]
Arimaa 64 43[17] 296[17] 70[18] ?, but in EXPTIME
Go (19x19) 361 171[19] 360[1] 150[1] EXPTIME-complete[20]

[edit] See also

[edit] Notes and references

  1. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac Victor Allis (1994). Searching for Solutions in Games and Artificial Intelligence. Ph.D. Thesis, University of Limburg, Maastricht, The Netherlands. ISBN 9090074880. 
  2. ^ a b c d Stefan Reisch (1980). "Gobang ist PSPACE-vollstandig (Gomoku is PSPACE-complete)". Acta Informatica 13: 5966. 
  3. ^ Hilarie K. Orman: Pentominoes: A First Player Win in Games of no chance, MSRI Publications – Volume 29, 1996, pages 339-344. Online: pdf.
  4. ^ Jonathan Schaeffer et al (July 6, 2007). "Checkers is Solved". Science. 
  5. ^ a b J. M. Robson (1984). "N by N checkers is Exptime complete". SIAM Journal on Computing, 13 (2): 252–267. doi:10.1137/0213018. 
  6. ^ See Allis 1994 for rules
  7. ^ a b M.P.D. Schadd, M.H.M. Winands, J.W.H.M. Uitweijk, H.J. van den Herik and M.H.J. Bergsma (2008). "Best Play in Fanorona leads to Draw". New Journal of New Mathematics and Natural Compuational 4 (3): to appear. 
  8. ^ S. Iwata and T. Kasai (1994). "The Othello game on an n*n board is PSPACE-complete". Theor. Comp. Sci. 123 (123): 329–340. doi:10.1016/0304-3975(94)90131-7. 
  9. ^ Stefan Reisch (1981). "Hex ist PSPACE-vollständig (Hex is PSPACE-complete)". Acta Inf. (15): 167–191. 
  10. ^ a b The size of the state space and game tree for chess were first estimated in Claude Shannon (1950). "Programming a Computer for Playing Chess". Philosophical Magazine 41 (314).  Shannon gave estimates of 1043 and 10120 respectively, smaller than the estimates in the table, which are from Victor Allis's thesis. See Shannon number for details.
  11. ^ Aviezri Fraenkel and D. Lichtenstein (1981). "Computing a perfect strategy for n×n chess requires time exponential in n". J. Comb. Th. A (31): 199–214. 
  12. ^ http://portal.acm.org/citation.cfm?id=1290250
  13. ^ http://books.nips.cc/papers/txt/nips04/0259.txt
  14. ^ R. A. Hearn (2005-02-02). Amazons is PSPACE-complete.
  15. ^ a b Shi-Jim Yen, Jr-Chang Chen, Tai-Ning Yang, and Shun-Chin Hsu (March 2004). "Computer Chinese Chess". International Computer Games Association Journal 27 (1): 3–18. 
  16. ^ H. Adachi, H. Kamekawa, and S. Iwata (1987). "Shogi on n × n board is complete in exponential time". Trans. IEICE J70-D: 1843–1852. 
  17. ^ a b Christ-Jan Cox (2006). Analysis and Implementation of the Game Arimaa.
  18. ^ Brian Haskin (2007). Arimaa Branching Factor.
  19. ^ John Tromp and Gunnar Farnebäck (2007). Combinatorics of Go. This paper derives the bounds 48<log(log(N))<171 on the number of possible games N.
  20. ^ J. M. Robson (1983). "The complexity of Go", Information Processing; Proceedings of IFIP Congress, 413–417. 

[edit] External links