How many chess games are possible?
Posted by jmount 2 days ago
Comments
Comment by tromp 2 days ago
This applies to most if not all games. In our paper "A googolplex of Go games" [1], we write
"Estimates on the number of ‘practical’ n × n games take the form b^l where b and l are estimates on the number of choices per turn (branching factor) and game length, respectively. A reasonable and minimally-arbitrary upper bound sets b = l = n^2, while for a lower bound, values of b = n and l = (2/3)n^2 seem both reasonable and not too arbitrary. This gives us bounds for the ill-defined number P19 of ‘practical’ 19x19 games of 10^306 < P19 < 10^924 Wikipedia’s page on Game complexity[5] combines a somewhat high estimate of b = 250 with an unreasonably low estime of l = 150 to arrive at a not unreasonable 10^360 games."
> Our final estimate was that it is plausible that there are on the order of 10^151 possible short games of chess.
I'm curious how many arbitrary length games are possible. Of course the length is limited to 17697 plies [3] due to Fide's 75-move rule. But constructing a huge class of games in which every one is probably legal remains a large challenge; much larger than in Go where move legality is much easier to determine.
The main result of our paper is on arbitrarily long Go games, of which we prove there are over 10^10^100.
[1] https://matthieuw.github.io/go-games-number/AGoogolplexOfGoG...
[2] https://en.wikipedia.org/wiki/Game_complexity#Complexities_o...
Comment by jmount 2 days ago
I remember from a lot of combinatorial problems (like cutting up space with hyper-planes or calculating VC dimension) that one sees what looks like exponential growth until you have a number of items equal to the effective dimension of the system and then things start to look polynomial.
BTW: I was going through some of your lambda calculus write-ups a while ago. Really great stuff that I very much enjoyed.
Comment by Someone 1 day ago
Chances are there are games of lengths 3 and 5, too. With that branching factor, there are 1,000, respectively 100,000 of those, for a total of 111,000. That’s over ten times as many games as estimated.
The larger the spread in game length towards games that are larger than average, the more the proposed estimate underestimates the actual number.
Comment by tromp 1 day ago
That's still a pretty good estimate of an exponentially large quantity; the exponent being off by only 1. With these estimates you cannot hope to do better than estimating the exponent.
Comment by Someone 1 day ago
And these tweaks do not complicate the math.
Comment by qsort 2 days ago
Comment by Sesse__ 2 days ago
Comment by qsort 2 days ago
The difference is extremely minor and has almost no strategic implications, it's just an interesting corner case.
Comment by Sesse__ 1 day ago
The game is drawn when a position has arisen in which neither player can checkmate the opponent’s king with any series of legal moves. The game is said to end in a ‘dead position’. This immediately ends the game, provided that the move producing the position was legal. (See Article 9.6)
And 9.6 just states: The game is drawn when a position is reached from which a checkmate cannot occur by any possible series of legal moves. This immediately ends the game, provided that the move producing this position was legal.
And similarly 6.9, which governs loss on time: Except where one of the Articles: 5.1.a, 5.1.b, 5.2.a, 5.2.b, 5.2.c applies, if a player does not complete the prescribed number of moves in the allotted time, the game is lost by the player. However, the game is drawn, if the position is such that the opponent cannot checkmate the player’s king by any possible series of legal moves.
So it's at least ten years old, but possibly quite more. I know I have a copy of the 1984 rules (or possibly even older) somewhere on paper, but then I'd have to go into the attic :-)Comment by TZubiri 2 days ago
Comment by lmm 1 day ago
Comment by TZubiri 1 day ago
Something in high elo may obviously be a draw, like KRPPP vs KRPP, or KRN vs KR but not necessarily in lower elo.
Comment by Sesse__ 1 day ago
Basically, once you've lost on time, you're giving up the right to any sort of agency, and thus the Elo doesn't matter. The rules are charitably giving you a rating of minus infinity and allow you to attempt salvaging half a point with that.
Comment by jmount 2 days ago
Comment by Someone 1 day ago
I don’t see what makes that technically difficult. The number of possible positions is finite, so just enumerate the game tree and check whether it contains a checkmate situation.
I also don’t see why it would be almost impossible in practice. Aren’t the only weird situations ones where there are pawns that could be promoted to queens if they weren’t blocked by other pawns, and those pawns prevent all other pieces on the board from taking pawns and from checkmating the king?
Comment by qsort 17 hours ago
- Trivial material checks don't work: even if you're sophisticated (light color vs. dark color bishops) there exist positions, even with pawns, that are drawn as per the rule as stated.
- Enumerating the game tree is obviously correct but it's too large to do in practice, we want an answer before the heat death of the universe.
So, what code do you put inside that function? If I'm not mistaken there is an "official" algorithm to do it, but it's very complicated, and in practice in computer chess a simplified version of the rule (a list of cases with "insufficient material") is used.
Again, it's mostly nerdy navel gazing, the consequences on actual play are minuscule, but it's interesting that many games have nontrivial termination if we follow the letter of the rules.
Comment by program_whiz 1 day ago
Comment by BobaFloutist 1 day ago
I'm having a hard time picturing this scenario. Is it that any move to take a pawn places the mover in check?
Comment by Someone 1 day ago
Comment by lxgr 1 day ago
Comment by eszed 1 day ago
Comment by lxgr 1 day ago
Heuristics get them very close, but I vaguely remember hearing that sometimes the tables will find an obscure move sequence to turn around a draw to a win 15 or 20 moves in that a human has no chance of spotting.
These tablebases do have something eerie to them, as they represent the phase transition from heuristics to the "solved" part of chess. Lichess will automatically swap to them once it's feasible, and instead of a position evaluation, you'll just instantly see whether it's winning, losing, or drawing. Ken Thompson called it "playing chess with God": https://en.wikipedia.org/wiki/Endgame_tablebase#%22Play_ches...
That said, this can happen with chess engines as well; if a position can be exhaustively analyzed, it'll show you "winning/losing/drawing in n moves" just like the tablebases. The tablebases just guarantee that they'll find that solution in constant time.
Comment by GMoromisato 2 days ago
Or maybe the question should be what percent of games reach a position that has never before been seen?
Comment by recursivecaveat 2 days ago
Comment by squidbeak 1 day ago
Another distinction needs to be made between positions seen and positions played. Almost every viable position will have been seen in preparation well beyond 10 moves. But seeing them on the board is rarer.
Comment by empiko 1 day ago
Comment by tromp 2 days ago
Comment by bdamm 2 days ago
Comment by dpc050505 2 days ago
Comment by reassess_blind 2 days ago
Comment by jonas_kgomo 2 days ago
Comment by adonovan 2 days ago
Comment by BobaFloutist 1 day ago
The total size of the universe is unknown, and could (and likely does) have way more atoms than that.
Actually, that's a fun thought: assuming homogenuity of matter between the observable and unobservable universe, how much bigger would the unobservable universe need to be to render some of these claims no longer true?
Because you're right to point out that factorials grow absurdly quickly. It's entirely possible my caveat straight up doesn't matter.
Edit: Ok, I'm seeing Wikipedia has a (disputed) estimate for the diameter of the total universe as 10^10^10^128 megaparsecs. Then, radius cubed should be 1/2(10^10^10^128^3)=1/210^10^10^131, as opposed to the radius of the observable universe being a nice, clean 14 billion parsecs = 1410^3 megaparsecs, making the radius cubed 1410^4 megaparsecs. I don't think I have a big enough calculator for this, but for fun, let's say 128^3 is roughly 2,000,000. Then we can rewrite T, the relative volume of the total universe, as 1/210^10^10^2*(10^ 6). I guess if we call 14 close enough to 10, then our density is 10^80/10^6=10^74 atoms for every pi megaparsecs cubed.
Going off the heuristic that n!<n^n, and the total universe can trivially produce (10^10)^(10^10), we would need to rearrange >10^10 objects just to even start to think about the number of (megaparsecs cubed)/pi it might have, let alone the 10^74 those each have.
We might not have enough decks of cards for this one.
(Feel free to criticize/tear down my math or logic anywhere in this one, it's very much off the cuff and I'm sure I made at least as many egregious errors in computing exponents as I did computations. No math class I've taken yet really prepares you to handle exponents raised four deep.)
Comment by paulpauper 2 days ago
Comment by LegionMammal978 2 days ago
Comment by RA_Fisher 2 days ago
Comment by erehweb 1 day ago
Comment by Mordisquitos 2 days ago
Comment by DSMan195276 2 days ago
There is additionally the 75-move rule where the the game is forced to be over without either player claiming the rule (the arbiter just ends the game), that rule would give an upper bound regardless of the players knowledge of the rules.
Comment by jonah-archive 2 days ago
The author points out that:
"This rule only applied to games started after its introduction, so it is possible that some pre-1561 games are still in progress and may never end."
Comment by drpixie 1 day ago
The 75-move rule is automatic, so that would be the limiting factor.
Note, that 75-move rule is only applicable after no pawn has moved or a piece has been captured. So our immortals can do a lot of shuffling things around.
I'm thinking that the number of moves of the longest game is going to be (16 pawns * 7 moves each + 16 pawns being captured + 14 other pieces each being captured, not the kings) * 75 moves for shuffling around = 10650 moves.
That's only 1 week at 1 move per minute! But given the permutations, it might take much longer to calculate the actual moves required to get to the end state :)
Comment by Sesse__ 1 day ago
Comment by DSMan195276 1 day ago
Comment by LegionMammal978 2 days ago
- After threefold repetition or 50 moves, either player may claim a draw.
- After fivefold repetition or 75 moves, the game is automatically drawn.
Most modern counts of the longest possible chess game, or the total number of possible chess games, are based on fivefold repetition and the 75-move rule.
Meanwhile, threefold repetition and the 50-move rule are still relevant in endgame tablebases, since they rule out certain forced mate sequences.
Comment by Sesse__ 1 day ago
Here's an example (adapted from the URL below): https://syzygy-tables.info/?fen=3R4/5R2/8/8/8/1K6/8/4k3_w_-_... — if you asked pretty much any player, even a child, how to win this, they'd show the staircase mate starting with Re7+ (mate in 4). If you asked a computer or the older Nalimov tablebases, it would say Kc2! (mate in 2). However, if you ask the Syzygy tablebases, they would argue that this is not optimal if we are extremely close to the 50-move rule, so the safest and thus best move is Rf2!! which forces Black to capture the rook on the next turn (they have no other legal moves), resetting the counter and giving a mate in 18.
There were a set of experimental DTM50 tablebases made at some point (though not made public); they store the shortest mate for all 100 possible zeroing counters in any position. See https://galen.xyz/egtb50/ for some discussion.
Comment by eulgro 2 days ago