26

Chess is an incredibly intricate game, offering an immense number of moves and combinations. Due to this complexity, determining the precise count of legal chess games poses a significant challenge. As of my knowledge, the total number of possible legal chess games remains unknown due to the vast array of potential moves and positions that can emerge during gameplay.

However, I've been pondering an intriguing question: Can we establish whether the total number of legal chess games is odd or even? It's a captivating puzzle that has captured my attention. I've given it considerable thought, but I must admit that I'm still uncertain about the parity of the total number of games. Can anyone direct me how to approach this?

  • 8
    The odds are even !$;;$ :) – true blue anil Jun 13 '23 at 19:45
  • 4
    How many different game prefixes are there where the knights move around a whole bunch and then return to their starting squares? If that number is even, then the number of distinct games is even. If it's odd, then that's not enough to know. – Dan Uznanski Jul 02 '23 at 10:40
  • 4
    @DanUznanski, the problem here is 3-fold repetition rule. – GraduateStudent Jul 02 '23 at 13:06
  • 2
    I'd try answering simpler questions first: the parity of games with missing pieces, eg, 2 kings, a king and a knight, etc. – user619894 Jul 02 '23 at 16:57
  • 2
    @GraduateStudent Threefold repitition and fivefold repitition shouldn't be too much of an issue with the knight-moving approach, because, once a pawn advances, we will be no longer able to repeat the starting position again. However, the fifty-move rule and the seventy-five move rule do pose challenges to the knight-moving approach, because not every knight-moving prefix has the same number of moves. – Gavin Dooley Jul 03 '23 at 12:28
  • 1
    Actually, now that I think of it, the fifty-move and seventy-five-move rules shouldn't be too much of an issue either, because the count is reset once a pawn moves. – Gavin Dooley Jul 03 '23 at 13:26
  • 5
    @Enforce If there's an even number of prefixes that return to the starting position, then we can "pair up" each game starting with prefix $p_{2n}$ with a game starting with prefix $p_{2n+1}$ that plays out exactly like it after the return to the starting position. – Gavin Dooley Jul 03 '23 at 14:20
  • Related: https://en.wikipedia.org/wiki/Shannon_number –  Jul 03 '23 at 16:49
  • 1
    @GavinDooley But let's take any prefix P(2n) and build a game that starts with P(2n) that has a position X which is inside the prefix P(2n+1) but not inside P(2n) that is reached twice in the game and then the game could go on in multiple ways. All of these games end at the second time X is reached if the prefix is P(2n+1) instead of P(2n), because X is also inside P(2n+1) and so it is reached 3 times. How do you pair up such games? – SummertimeS4dness Jul 18 '24 at 17:06
  • @SummertimeS4dness you are absolutely right, and a simple parity argument would not work.

    A more refined parity argument, showing that, for each position reachable only through knight moves, there are an even number of ways to reach it, would do the trick, since, once a pawn moves, we will never reach a previous position again

    – Gavin Dooley Jul 22 '24 at 13:13

2 Answers2

4

My ideas aren't completely thought-through, but here's what I've come up with so far:

$\Large \text{Switching colors}$

The idea here is to "pair up" games to prove that the total number of games is even.

Given a position for the white pieces, we'll try to construct the exact same position, but for the black pieces. This can be accomplished by making white "skip" a turn toward the start of the game, making it look like black had made the first move. Doing this is simple, though it requires that some of your pieces have space to move.

Here's an example of how it can be done, the idea being that white spends 3 turns moving a piece away and back to its original position while black only takes 2 turns:

e4 - e5 - Bd3 - Be7 - Be2 - Bf8 - Bf1 helping in adding the picture

Performing a such a sequence requires that both sides have a rook, bishop or queen with enough space to move away and back. I believe that any game that doesn't end in an early stalemate due to horses moving around presents a such opportunity.

The game isn't completely identical when black "starts", but its basically just normal chess flipped horizontally and vertically, so I'd expect the set of playable games in either version to be the same.

Note that this can't be done with knights since they always take an even number of turns to return to a square.

There's another approach that one can consider:

$\Large \text{Permutating knights}$

As was mentioned by @DanUznanski in a comment, you can create copies of any given game by moving knights around before the first $real$ move.

Any given permutation of knights can be mirrored on the $y-$axis. Consequently, given $n$ permutations starting with $Nf3$, there are $n$ corresponding permutations starting with $Nc3$ (all later moves are also mirrored), making for a total even number of $2n$ permutations.

That means that, given any game, there are $2n$ ways to append knight permutations to the start, giving you $2n$ "copies" of said game.

Also counting the game that doesn't have any prepended permutations, there are a total of $2n + 1$ "versions" of each game. Since $2n + 1$ is odd, this approach currently doesn't deliver meaningful evidence.

There is, however, something I skipped, that may change the result: permutations where a white knight lands on $c6$ or $e6$ can't be mirrored, because, landing on $d6$ or $f6$, they'd put the black king in check, forcing him to move or take the knight (and thus invalidating the permutation). The same problem can occur for black knights. This means that certain permutations don't have a corresponding mirrored equivalent. I believe that the number of thus lost possibilities is even, meaning that the total number of $versions$ of a given match would still be odd.

Deeper analysis may, however, reveal that the number of lost possibilities is odd, which would render this method fruitful, proving that the total number of games is even.

P.S. could anyone be so kind as to embed the image? I don't have enough reputation to.

$\Large \text{Response to Prem's answer}$

First off, thank you for your feedback to my ideas.

I don't quite understand what you mean with (1), so I'll address the other ones for now:

(2) I do believe that a match-up is nonetheless always available, since, apart from left and right having been switched, everything is still the same (relative position of pieces, long castle towards queen, etc.)

(3 - 6) I see what you mean, and it may indeed pose a problem.

My idea was that the match-up is made as early on in the game as possible, avoiding the problems that you mentioned.

This would, of course, require checking that a color-swap can always be achieved before checkmate, similarly to how you would check the parity of starting positions. I do believe that it'll always be possible, since it only requires pawns moving to make sufficient space for a bishop, queen, ... to perform the color switch.

  • 1
    if the location of the picture is not where you wanted it to be added just edit the text and put a * where you want me to put it , though I did upvote your comment I think around 10 or 15 you can add a pic – dareen Jul 20 '24 at 14:41
  • 1
    @dareen that's the correct position, thanks! – BobTheThird Jul 20 '24 at 14:44
  • your welcome it was enjoyable to read your comment – dareen Jul 20 '24 at 14:49
  • 1
    You can read my comment about the knights approach up in the comments to the question but I think the idea is the same with the swi.col approach, basically you are doing some moves called prefix before the game really starts and you pair up with the same game without the prefix. But if in the game without the prefix a position that belongs to the prefix is reached 2 times the game continues while the game with the prefix ends because the position is reached actually 3 times, so how do you pair up such games? – SummertimeS4dness Jul 21 '24 at 00:04
  • I am curious about how you would handle the black pieces in a given position for the white pieces, specifically in a scenario where white plays its first move a3? – zero2infinity Jul 21 '24 at 10:29
  • @zero2infinity do you mean how I would construct a position where black "starts" with a7? – BobTheThird Jul 21 '24 at 11:05
  • @SummertimeS4dness I see what you mean... For the same position as those of the prefix to be reached again twice, it means that no pawns are moved anymore, which means that it would also be a permutation of bishops, queens, etc. I can't seem to figure if the number of such permutations is even or odd. – BobTheThird Jul 21 '24 at 11:14
  • 1
    @BobTheThird, Yes. I think the way to go is white plays a knight, black plays h6, white plays the knight back – zero2infinity Jul 21 '24 at 16:02
  • 1
    Almost any pawn move from either colour allows for the 'switching of colours'. Suppose for example that white plays g2. Then white can perform an odd number of Bishop moves, returning to f1, while black shuffles their knight backwards and forwards. (An even number of moves). The only exceptions to this are moving the Rook pawns 1 square which does not allow the Rooks to move an odd number of times and return to their starting square. So the problem is essentially reduced to checking the number of games with only knight moves and moving the rook pawn 1 square – Ultra Jul 21 '24 at 17:16
  • 1
    @BobTheThird Am I correct in thinking that it may not matter that a knight lands on d6 or f6. If black takes with a pawn then we can perform 'switching colours' and hence there is an even number of games from this position. Or have I misunderstood? – Ultra Jul 21 '24 at 17:22
  • @Cristof012 you understood correctly, I think everything works fine the way you described it. The problem SummertimeS4dness mentioned with 3-fold repetition may still mess with the result though. – BobTheThird Jul 22 '24 at 08:17
  • can we reduce this three-fold repition modulo $2$ and do something about it? I am not sure what I want to say but this is just my intution. – zero2infinity Jul 22 '24 at 19:46
  • According to Wikipedia, the threefold-repetition rule also takes into account who's turn it is. Doesn't that actually mean that we can rule out potential stalemates because of the prefix, since the next player to move has changed? – BobTheThird Jul 23 '24 at 10:37
-1

Either this is a longish comment ( discussing the answer by user BobTheThird ) or a short answer ( using Heuristics ) or a combination of that.

My Solution in sky-high outline :

OP : Can anyone direct me how to approach this?

My way using Heuristics would be to ensure that almost every Initial Position (around 2 moves to 6 moves) can be arrived at in Even number of ways.
Those which have only one way (or Odd number of ways) to arrive at should be continued to few more moves until we have covered all Initial Positions.

Eg :

CHESS 1

Either the pawns have moved 1 square at a time or the pawns have moved 2 squares each , leaving it Whites turn to move.
There may be $n_1$ games from here onwards. Hence we will have $2n_1$ games from Start.

CHESS 2

White might have moved the pawn first or the knight first.
There may be $n_2$ games from here onwards. Hence we will have $2n_2$ games from Start.

CHESS 3
Either pawn could have moved first for White & for Black.
There may be $n_3$ games from here onwards. Hence we will have $4n_3$ games from Start.

Such Positions will give Even number of games.

Here is a tree view :

CHESS 4

The game moves downwards.
At the top we have the Starting Position. Black liens indicates moves , while Blue circles are Positions.
Some Positions ( Eg the left 3 Blue Circles in the lower row in the green rectangle ) can be arrived at in 2 ways. Continuing those games will always contribute Even number of games to the total.
The last Blue Circle in that lower row has one way to arrive at. Hence we check that further. We might get some Position which has Even number of ways to arrive at.
Hence all those will still contribute Even number of games to the total.

When we have checked around 12 moves (a guess) , almost all will be Even.
the few unresolved can be checked till around 24 moves (a guess) where all will be Even.
We could then conclude that there are Even number of Chess games in total.
Computer Checking will be essential here.

When we get Positions with one way to arrive at , how-ever low we go in that tree , then we have to count those Positions : When that count itself is Even , then total is still Even.

Discussing the answer by BobTheThird :

It contains nice ideas , though I think it is not workable , in current form.

My main Objections ( which will not fit in Comment Box ) are these :

(1) BobTheThird is trying to make it like all White Positions/Moves can be matched (Paired) with Black Positions/moves. Unfortunately , when White gives a check , Black can not make independent moves.
(2) Chess Board is not Symmetric : the 2 Queens & the 2 Kings have to line up. When this Switch was not there , we will have Symmetry & BobTheThird might be able to match up. With this Switch , matching up is not always available.
(3) When the game nearing the end , yet the Pairing has not yet happened (at the end game level) & the rules force a Draw , then these unmatched games will complicate the total.
(4) Castling can be done once per side : We can not repeat it to make some Pair when necessary.
(5) Promotion is one-way : We can not revert it to make a Pair when necessary.
(6) En Passant is one-time/one-way : Delaying/reverting to make a Pair when necessary is not allowed.

I am not trying to find faults in the answer by BobTheThird , I am only high-lighting issues which I detected. These will have to be rectified to ensure matching up to give Even total.

Prem
  • 14,696
  • 1
    In response to (1), I do not believe BobTheThird was suggesting that moves can be paired up, but games can be paired up by 'switching colours'. This would mean that your suggested game can be paired up with another possible game with colours reversed, where Black gives a check – Ultra Jul 23 '24 at 15:27
  • 1
    If you can arrive to a position X in an even number of ways you may can't say from this position X there are n games because each way of arriving hits some different positions that can be reached also after position X so the game could be forced to end for three fold if you arrive to X in one way while it could continue if you arrive to X in an other way. So the set of possible games after X is not the same for each way you arrive to it. – SummertimeS4dness Jul 23 '24 at 16:25
  • Symmetric. Board is necessary to switch colours in some cases , @Cristof012 , which might not always work out. White can give check with 3 moves of Queen Side Knight , while Black has made "2" moves. Switch colours : Black can give check with 3 moves of Queen Side Knight , while White has made "3" moves. Here "Position" might match yet game can not match. [[ I will try to update my answer ]] – Prem Jul 23 '24 at 17:34
  • While you state is true , that was why I was considering Initial Positions , @SummertimeS4dness , where we might not have to worry about that. Explicitly handling that , I think when "Draw is about to occur" , we should continue to move forward to count those specific ways else we might consider the other ways Even. [[ I will try to update my answer ]] – Prem Jul 23 '24 at 17:34
  • @Prem I see your point, though I believe that, as long as there's no stalemate due to threefold repetition, how the game got to the point where colors are "switched" doesn't matter. 3-fold repetition could also only be reached if no "interesting" moves were made afterwards, i.e. the players just permutated non-pawn (and non-king / rook, if there's still castling rights) pieces.

    Though I don't know right now if the number of such permutations has to be even

    – BobTheThird Jul 23 '24 at 19:35