The game of Go is one of the most popular games in the world. As a result of its elegant and simple rules, the game has long been an inspiration for mathematical research. Shen Kuo, an 11th century Chinese scholar, estimated in his Dream Pool Essays that the number of possible board positions is around 10172. In more recent years, research of the game by John H. Conway led to the development of the surreal numbers and contributed to development of combinatorial game theory (with Go Infinitesimals[1] being a specific example of its use in Go).
Generalized Go is played on n × n boards, and the computational complexity of determining the winner in a given position of generalized Go depends crucially on the ko rules.
Go is “almost” in PSPACE, since in normal play, moves are not reversible, and it is only through capture that there is the possibility of the repeating patterns necessary for a harder complexity.
Without ko, Go is PSPACE-hard.[2] This is proved by reducing True Quantified Boolean Formula, which is known to be PSPACE-complete, to generalized geography, to planar generalized geography, to planar generalized geography with maximum degree 3, finally to Go positions.
Go with superko is not known to be in PSPACE. Though actual games seem never to last longer than
n2
Japanese ko rules state that only the basic ko, that is, a move that reverts the board to the situation one move previously, is forbidden. Longer repetitive situations are allowed, thus potentially allowing a game to loop forever, such as the triple ko, where there are three kos at the same time, allowing a cycle of 12 moves.
With Japanese ko rules, Go is EXPTIME-complete.[3]
The superko rule (also called the positional superko rule) states that a repetition of any board position that has previously occurred is forbidden. This is the ko rule used in most Chinese and US rulesets.
It is an open problem what the complexity class of Go is under superko rule. Though Go with Japanese ko rule is EXPTIME-complete, both the lower and the upper bounds of Robson’s EXPTIME-completeness proof break when the superko rule is added.
It is known that it is at least PSPACE-hard, since the proof in of the PSPACE-hardness of Go does not rely on the ko rule, or lack of the ko rule. It is also known that Go is in EXPSPACE.[4]
Robson showed that if the superko rule, that is, “no previous position may ever be recreated”, is added to certain two-player games that are EXPTIME-complete, then the new games would be EXPSPACE-complete. Intuitively, this is because an exponential amount of space is required even to determine the legal moves from a position, because the game history leading up to a position could be exponentially long.
As a result, superko variants (moves that repeat a previous board position are not allowed) of generalized chess and checkers are EXPSPACE-complete, since generalized chess[5] and checkers[6] are EXPTIME-complete. However, this result does not apply to Go.
A Go endgame begins when the board is divided into areas that are isolated from all other local areas by living stones, such that each local area has a polynomial size canonical game tree. In the language of combinatorial game theory, it happens when a Go game decomposes into a sum of subgames with polynomial size canonical game trees.
With that definition, Go endgames are PSPACE-hard.[7]
This is proven by converting the Quantified Boolean Formula problem, which is PSPACE-complete, into a sum of small (with polynomial size canonical game trees) Go subgames. Note that the paper does not prove that Go endgames are in PSPACE, so they might not be PSPACE-complete.
Determining which side wins a ladder capturing race is PSPACE-complete, whether Japanese ko rule or superko rule is in place.[8] This is proven by simulating QBF, known to be PSPACE-complete, with ladders that bounce around the board like light beams.
Since each location on the board can be either empty, black, or white, there are a total of 3n2 possible board positions on a square board with length n; however not all of them are legal. Tromp and Farnebäck derived a recursive formula for legal positions
L(m,n)
L(19,19)
L ≈ ABm+nCmn
A ≈ 0.8506399258457145
B ≈ 0.96553505933837387
C ≈ 2.975734192043357249381
Board size n×n | 3n2 | Percent legal | L | |
---|---|---|---|---|
1 × 1 | 3 | 33.33% | 1 | |
2 × 2 | 81 | 70.37% | 57 | |
3 × 3 | 19,683 | 64.40% | 12,675 | |
4 × 4 | 43,046,721 | 56.49% | 24,318,165 | |
5 × 5 | 847,288,609,443 | 48.90% | 414,295,148,741 | |
9 × 9 | 4.43426488243 × 1038 | 23.44% | 1.03919148791 × 1038 | |
13 × 13 | 4.30023359390 × 1080 | 8.66% | 3.72497923077 × 1079 | |
19 × 19 | 1.74089650659 × 10172 | 1.20% | 2.08168199382 × 10170 |
The computer scientist Victor Allis notes that typical games between experts last about 150 moves, with an average of about 250 choices per move, suggesting a game-tree complexity of 10360.[11] For the number of theoretically possible games, including games impossible to play in practice, Tromp and Farnebäck give lower and upper bounds of 101048 and 1010171 respectively.The lower bound was improved to a googolplex by Walraet and Tromp.The most commonly quoted number for the number of possible games, 10700[12] is derived from a simple permutation of 361 moves or . Another common derivation is to assume N intersections and L longest game for N total games. For example, 400 moves, as seen in some professional games, would be one out of 361400 or 1 × 101023 possible games.
The total number of possible games is a function both of the size of the board and the number of moves played. While most games last less than 400 or even 200 moves, many more are possible.
Game size | Board size N (intersections) | N! | Average game length L | N | Maximum game length (# of moves) | Lower limit of games | Upper limit of games | |
---|---|---|---|---|---|---|---|---|
2 × 2 | 4 | 24 | 3 | 64 | 386,356,909,593[13] | 386,356,909,593 | ||
3 × 3 | 9 | 5 | ||||||
4 × 4 | 16 | 9 | ||||||
5 × 5 | 25 | 15 | ||||||
9 × 9 | 81 | 45 | ||||||
13 × 13 | 169 | 90 | ||||||
19 × 19 | 361 | 200 | 1048 | 101048 | 1010171 | |||
21 × 21 | 441 | 250 |
The total number of possible games can be estimated from the board size in a number of ways, some more rigorous than others. The simplest, a permutation of the board size, (N)L, fails to include illegal captures and positions. Taking N as the board size (19 × 19 = 361) and L as the longest game, N forms an upper limit. A more accurate limit is presented in the Tromp/Farnebäck paper.
Longest game L (19 × 19) | (N)L | Lower limit of games | Upper limit of games | Notes | |
---|---|---|---|---|---|
1 | 361 | 361 | 361 | White resigns after first move, 361 ignoring all symmetry including y = x else (distances from corner) 10×10−10=90 90/2=45 +10 (adding back x = y points of symmetry) = 55. | |
2 | 722 | 721 | Black resigns after white's first move, 721 ignoring all symmetry including y=x else 19×19−19=342 342/2=171 +19 = 190 − 1 = 189. | ||
50 | |||||
100 | |||||
150 | |||||
200 | |||||
250 | |||||
300 | |||||
350 | |||||
361 | Longest game using 181 black and 180 white stones | ||||
411 | n/a | Longest professional game[14] | |||
500 | n/a | ||||
1000 | n/a | ||||
47 million | n/a | 10108 | 3613 moves | ||
1048 | n/a | 101048 | 1010171 | Longest game |
10700 is thus an overestimate of the number of possible games that can be played in 200 moves and an underestimate of the number of games that can be played in 361 moves. Since there are about 31 million seconds in a year, it would take about years, playing 16 hours a day at one move per second, to play 47 million moves.