Game complexity

From Infogalactic: the planetary knowledge core
(Redirected from Game-tree complexity)
Jump to: navigation, search

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.

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 upper bound can often be computed by including illegal positions or 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.

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.

Decision trees

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

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 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, or:

GTC \geq b^d

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 complexities of each individual algorithm 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 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. 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]

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.

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[2]
Sim 15 3 8 14 3.7 PSPACE-complete[3]
Pentominoes 64 12 18 10 75 [4][5] ?, but in PSPACE
Kalah [6] 14 13 18 [4] Generalization is unclear
Connect Four 42 13 21 36 4 [1][7] ?, but in PSPACE
Domineering (8 × 8) 64 15 27 30 8 [4] ?, but in PSPACE; in P for certain dimensions[8]
Congkak 14 15 33 [4]
English draughts (8x8) (checkers) 32 20 or 18 31 70 2.8 [9][1] EXPTIME-complete[10]
Awari[11] 12 12 32 60 3.5 [1] Generalization is unclear
Qubic 64 30 34 20 54.2 [1] PSPACE-complete[2]
Fanorona 45 21 46 44 11 [12] ?, but in EXPTIME
Nine Men's Morris 24 10 50 50 10 [1] ?, but in EXPTIME
International draughts (10x10) 50 30 54 90 4 [1] EXPTIME-complete[10]
Chinese checkers (2 sets) 121 23 [13] EXPTIME-complete [14]
Chinese checkers (6 sets) 121 78 [13] EXPTIME-complete [14]
Lines of Action 64 23 64 44 29 [15] ?, but in EXPTIME
Reversi (Othello) 64 28 58 58 10 [1] PSPACE-complete[16]
OnTop (2p base game) 72 88 62 31 23.77 [17]
Hex (11x11) 121 57 98 40 280 [4] PSPACE-complete[18]
Gomoku (15x15, freestyle) 225 105 70 30 210 [1] PSPACE-complete[2]
Go (9x9) 81 38 45 [1][19] EXPTIME-complete[20]
Chess 64 47 123 80 35 [21] EXPTIME-complete (without 50-move drawing rule) [22]
Connect6 361 172 140 30 46000 [23] PSPACE-complete[24]
Backgammon 28 20 144 50-60 250 [25] Generalization is unclear
Xiangqi 90 40 150 95 38 [1][26][27] ?, believed to be EXPTIME-complete
Abalone 61 25 154 87 60 [28] [29] PSPACE-hard, and in EXPTIME
Havannah 271 127 157 66 240 [4][30] PSPACE-complete[31]
Janggi 90 44 160 100 40 [27] ?, believed to be EXPTIME-complete
Quoridor 81 42 162 91 60 [32] ?, but in PSPACE
Carcassonne (2p base game) 72 >40 195 71 55 [33] Generalization is unclear
Amazons (10x10) 100 40 212 84 374 or 299[34] [35][36] PSPACE-complete[37]
Go (13x13) 169 79 90 [1][19] EXPTIME-complete[20]
Shogi 81 71 226 115 92 [26][38] EXPTIME-complete[39]
Arimaa 64 43 402 92 17281 [40][41][42] ?, but in EXPTIME
Go (19x19) 361 171 360 150 250 [1][19] EXPTIME-complete[20]
Stratego 92 115 535 381 21.739 [43]
Double dummy bridge[44] (52) <17 <40 52 5.6
Bejeweled and Candy Crush (8x8) 64 <50 [45] NP-hard

See also

Notes and references

  1. 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 Lua error in package.lua at line 80: module 'strict' not found.
  2. 2.0 2.1 2.2 2.3 Lua error in package.lua at line 80: module 'strict' not found.
  3. Wolfgang Slany: The Complexity of Graph Ramsey Games
  4. 4.0 4.1 4.2 4.3 4.4 4.5 Lua error in package.lua at line 80: module 'strict' not found.
  5. Hilarie K. Orman: Pentominoes: A First Player Win in Games of no chance, MSRI Publications – Volume 29, 1996, pages 339-344. Online: pdf.
  6. See van den Herik et al for rules.
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.
  10. 10.0 10.1 Lua error in package.lua at line 80: module 'strict' not found.
  11. See Allis 1994 for rules
  12. Lua error in package.lua at line 80: module 'strict' not found.
  13. 13.0 13.1 Lua error in package.lua at line 80: module 'strict' not found.
  14. 14.0 14.1 Lua error in package.lua at line 80: module 'strict' not found. Proves completeness of the generalization to arbitrary graphs.
  15. Lua error in package.lua at line 80: module 'strict' not found.
  16. Lua error in package.lua at line 80: module 'strict' not found.
  17. Lua error in package.lua at line 80: module 'strict' not found.
  18. Lua error in package.lua at line 80: module 'strict' not found.
  19. 19.0 19.1 19.2 Lua error in package.lua at line 80: module 'strict' not found. This paper derives the bounds 48<log(log(N))<171 on the number of possible games N.
  20. 20.0 20.1 20.2 Lua error in package.lua at line 80: module 'strict' not found.
  21. The size of the state space and game tree for chess were first estimated in Lua error in package.lua at line 80: module 'strict' not found. Shannon gave estimates of 1043 and 10120 respectively, smaller than the upper bound in the table, which is detailed in Shannon number.
  22. Lua error in package.lua at line 80: module 'strict' not found.
  23. Lua error in package.lua at line 80: module 'strict' not found.
  24. On the fairness and complexity of generalized k-in-a-row games
  25. http://books.nips.cc/papers/txt/nips04/0259.txt
  26. 26.0 26.1 Lua error in package.lua at line 80: module 'strict' not found.
  27. 27.0 27.1 Lua error in package.lua at line 80: module 'strict' not found.
  28. Lua error in package.lua at line 80: module 'strict' not found.
  29. Lua error in package.lua at line 80: module 'strict' not found.
  30. Lua error in package.lua at line 80: module 'strict' not found.
  31. Lua error in package.lua at line 80: module 'strict' not found.
  32. Lua error in package.lua at line 80: module 'strict' not found.
  33. Lua error in package.lua at line 80: module 'strict' not found.
  34. The lower branching factor is for the second player.
  35. Lua error in package.lua at line 80: module 'strict' not found.
  36. Lua error in package.lua at line 80: module 'strict' not found.
  37. Lua error in package.lua at line 80: module 'strict' not found.
  38. Lua error in package.lua at line 80: module 'strict' not found.
  39. Lua error in package.lua at line 80: module 'strict' not found.
  40. Lua error in package.lua at line 80: module 'strict' not found.
  41. Lua error in package.lua at line 80: module 'strict' not found.
  42. Lua error in package.lua at line 80: module 'strict' not found.
  43. Lua error in package.lua at line 80: module 'strict' not found.
  44. 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, which motivates including it in the list. 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. Note that the last 4 plies are always forced moves with branching factor 1.
  45. Lua error in package.lua at line 80: module 'strict' not found.

External links