21

Imagine we are pitting two automated players (bots) against each other, but instead of thoughtful moves made by the players, they make completely random choices. I realize that this is not really the point of playing chess, but it sets the groundwork for a theoretical chess question.

Is there an inherent advantage to the player who goes first, or the player who goes second?

'Inherent advantage' here means that the probability of one player winning is higher than the other, and that these randomized conditions don't account for how actual players would play. If such an advantage exists, it may be entirely wiped away by how humans play chess with each other. I want to emphasize that this question is not meant to generalize to either human or algorithmic play.

Update

I got the results back of 1000000 randomly-played games thanks to a small adjustment to itub's code. I've whipped up a basic plot to show the results.

enter image description here

But if you prefer the specific numbers, here's the printout:

Counter({'is_insufficient_material': 474230,
'can_claim_fifty_moves': 169123,
'can_claim_threefold_repetition': 149398,
'1-0': 75868,
'0-1': 75239,
'is_stalemate': 56142})

As promised in the comments on one of the answers, I was going to calculate a Wilson score interval with continuity correction. I wrote the following function in Python to accomplish that.

import numpy as np
from scipy import stats

def wilson_cont(n1, n2, alpha=0.05):
    '''
    Wilson score interval with continuity correction.
    Two-tail interval is assumed.

    Parameters:
        n1 (int): Count of outcome 1.
        n2 (int): Count of outcome 2.
        alpha (float):

    Source:
        https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval
    '''
    assert type(n1) == int and type(n2) == int
    assert 0 < alpha < 1
    z = stats.norm.ppf(1 - alpha / 2)
    n = n1 + n2
    phat = n1 / n
    num1 = 2 * n * phat + z**2
    num2 = z * np.sqrt(z**2 - 1 / n + 4 * n * phat * (1 - phat) + 4 * phat - 2) + 1
    num3 = z * np.sqrt(z**2 + 1 / n + 4 * n * phat * (1 - phat) - 4 * phat - 2) + 1
    denom = 2 * (n + z **2)
    return max(0, (num1 - num2) / denom), min(1, (num1 + num3) / denom)

And calling this function on the outcome counts where either white or black win, we have:

>>> print(wilson_cont(75868, 75239))
(0.4995569815292355, 0.5046054923932771)

This result, confirming some of the comments and answers below, is not significantly different from 50 %. As MaxW has pointed out in their answer, a similar calculation has been done on an even bigger sample that concluded that there was a statistically significant difference. One concern I have with all these calculations, mine and others, is that they become more sensitive to deviations as the sample size becomes larger. This means it is difficult to determine whether there's truly a difference using standard null hypothesis testing when our sample size becomes extremely large, but if we don't sample enough then our sample won't be representative enough. What this has illuminated to me is a form of conditional reasoning that if there is a difference, then it is extremely small in terms of effect size.

My thanks to everyone who has shown interest in this post, and contributed their reasoning, research, or code into it.

  • "Not significantly different" just means your sample is not large enough, not that there is no actual difference – David Jun 26 at 9:28
  • @David Yes, that's right. As I state above, there's either no difference or it is a small difference. We can safely rule out there being a large difference. – Galen Jun 26 at 14:12
  • Sure! I was just making a clarification for people who could find themselves confused on the matter – David Jun 28 at 16:56
23

I once wrote a program to make random moves, had it play 1000 games, and these were my results:

Outcome                        Count  Avg. #moves
-----------------------------  -----  -----------
Draw by insufficient material    500          179
Draw by fifty-move               157          208
Draw by threefold repetition     147          164
Black wins by checkmate           75           87
White wins by checkmate           72           78
Draw by stalemate                 49          138

The sample is too small to reach a firm conclusion, but as you can see, Black actually won more games than White! (I think that was just luck.) More noticeable, though, is that the overwhelming majority of games are draws.

My hunch is that there is neither White nor Black have any advantage when making random moves. The oft-quoted first-move advantage of White is based on the notion that White has the initiative, but it is very easy to lose the initiative, and if you make random moves you are pretty much guaranteed to lose it very quickly. (Edit: thanks to MaxW's answer, I'm pleased to see that someone actually went through the trouble of simulating billions of games and found that actually White does have a very slight, but statistically significant advantage: 7.7340% vs 7.7293%).

I originally posted the table above as an answer to a different question: Of all the possible legal chess games, how many end in white win, draw and black win (assuming 50 move rule)? That answer goes into more speculation about why most games are draws, but more importantly has the Python source code in case it helps run your own simulations.

| improve this answer | |
  • 8
    Given that there's a winner, then probability of black winning is about 51% in your data. Calculating a normal approximation interval ($n=147$, $z=1.96$) for this subspace suggests the probability of black winning (given that somebody wins) is between 43% and 59%, which is consistent with 50%. – Galen Apr 23 at 18:14
  • 4
    Thanks for linking to the source code. I'm using it to summarize a million games, which on my CPU will take a few days. I'm going to calculate a Wilson score interval with continuity correction to re-evaluate the significance. – Galen Apr 23 at 18:20
  • 3
    @MikeJones You migth make the first mistake, but the opponent has to take advantage of it, which at random play is unlikely. At first I thought white should have a slight advantage, because if you move first, you can mate first (and most mates would be early on in the game when there are many pieces on the board). On the other hand,in the shortest possible mate (fool's mate) it is black that mates. That should have a probability of roughly one in a million at random play (4 halfmoves). – user1583209 Apr 24 at 7:37
  • 1
    @user1583209: say both sides have 20 first moves, and 25 second moves on average, that's about 250k four half move games, four of which are fool's mate (there is a choice between f3 and f4, and between e6 and e5). So roughly one in 60k. I think the fact that black can mate earlier might be enough to give him a tiny, tiny advantage, but random play should wipe out almost all of it. I'm amazed that one of the sides wins as often as they do. – RemcoGerlich Apr 24 at 8:07
  • 1
    @alephzero In fact, MaxW's simulation shows there might even be a "reverse initiative" effect. If white puts black into check, black must make a substantively "useful" move which has a higher-than-average chance of capturing the attacking piece. By checking black, white puts himself at a higher risk of material loss, making future checkmates less likely. White has an advantage to checkmate early, but early checks are actually a liability. The later liability doesn't quite balance out the early advantage, though. – Nuclear Wang Apr 24 at 13:39
21

When moves are randomized, is there an inherent advantage to the player who goes first, or the player who goes second?

The first player has a slight advantage. When black has made n moves, then white has made n+1 when completing his turn. Even if black can mate on his n+1-th move black still loses.


EDIT My analysis was too simple, but I got lucky.

Over 29.28 billion random chess games white is slightly more likely to checkmate than Black (7.7340% vs 7.7293%).

That means for games than end because of a checkmate, white wins 50.015% of them and black wins 49.985%.

See: https://wismuth.com/chess/random-games.html

| improve this answer | |
  • 3
    When moves are being selected at random, it's not obvious to me that that's actually any kind of advantage for white. – Chris H Apr 24 at 6:23
  • 7
    @ChrisH - Knew someone had to do this. See wismuth.com/chess/random-games.html Over 29.28 billion random chess games white is slightly more likely to checkmate than Black (7.7340% vs 7.7293%), – MaxW Apr 24 at 7:58
  • 2
    @MaxW that link and the statistics from it answer the question, it belongs in your answer. – RemcoGerlich Apr 24 at 8:09
  • 1
    @ChrisH If every random move has some probability of being a winning move, then I would expect white to have a slight advantage because on average it gets to roll the dice more often than black. – JBentley Apr 25 at 9:46
1

The preceding answers are great, but I can add one point that has just occurred to me.

The statistical analysis suggests a small advantage for White in random chess. But any mating position can be "flipped" (pieces White<->Black, person to move changed and flip board top<-> bottom) to make a legal position with the other side mating. In other words, there are no cases where the parity present in the starting position can be kept all the way through to checkmate.

In other, other words: in the hugeness of chess there are exactly the same number of mating positions for White as Black. So it's slightly paradoxical then that more random games are won by White. I guess the answer is that to flip the parity requires following some relatively improbable path of moves (e.g. 1.c3 d5 2.c4 to simulate 1.d4 c5).

| improve this answer | |
  • 1
    I am not sure there is complete parity, because a position is not only defined by the pieces on the board, but also by: whose move it is, castling rights, en passant rights, three-fold repitition and 50 (75) move count. – user1583209 Apr 26 at 7:22
  • 1
    If you take the shortest mate, fool's mate that requires 4 half-moves if black mates or 5 half-moves if white mates. The extra half move that white makes might in fact hinder him from having the option to mate at half-move 5. If you look at the data, this is in fact what happens, for short games black has an advantage, but for longer games it is white that catches up. – user1583209 Apr 26 at 7:26
  • Thanks user1583209: I've clarified now that person to move flips. Castling rights and en passant rights change. "Threefold/fivefold repetition of position" by definition implies that the count is not part of position. However any reachable position can be reached without repetition of position. Similarly, 50/75 move count is not a factor of position, else you could never repeat a position! – Laska Apr 26 at 8:51
  • 1
    To Laska: That's not my data, I am just reading it. My guess would be that for very long games we approach 100% draw, so yes, in some sens w&b wins converge to 0. – user1583209 Apr 26 at 9:41
  • 1
    While every position can be flipped, it might require a different number of moves to reach it and therefore have a different probability. – user1583209 Apr 26 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.