Atanas K. Stefanov

Generating Chess960 positions with a coin


I sometimes take my friends to improvised swiss chess tournaments. I prefer to organise those in open spaces, outdoors. Most chess boards I cut and paint myself. Most pieces come from flea markets.

Chess960 (also Fischer random chess) is a chess variant that has been gaining popularity because it defies the opening theory in chess, and thus postpones the slow but sure death of the game. I am an avid chess player myself, and I have the luck of having most of my close friends somewhat invested in the game too. Our interest usually peaks during summer, but, having continuously to play each other, we soon get bored of each other’s play and we look for ways to spice the game a bit. Chess960 works for us, but I have an issue with it — it relies on randomness, and generating a random position is not easy without an electronic device. You can certainly use a phone, but what fun do you find in that?

I had a quick look-up of ways to manually generate a starting Chess960 position. Some guides involve using a suite of polyhedron dice, i.e. d4 + d6 + d8. This necessitates somewhat niche equipment that you cannot rely on having if you feel the sudden rush to play a quick game. Some realised that, and provided with a guide to generate a position using a standard die (d6) only. This, however, requires re-rolls in the cases where you need to emulate dice of lower order (e.g. d4). Consider the act of placing a Bishop on the board. Each Bishop can go on 4 squares only, so the standard-die guide instructs you to roll again if you score 5 or 6. This is inefficient — by my naïve estimate, you should lose at least a third of your time rolling a die in this case.

My problem came down to coming up with a more efficient method to generate a random number. It came to my attention that 960=21026960=2^{10}-2^6, which steered me towards the prospect of using a coin instead. Coins are common, and you one easily generate a number between 00 and 10231023 with ten flips. The binary representation of 960960 is very conveniently 111100000021111000000_2, meaning that we would have to re-flip only if we get heads in the first four flips. Or tails, depending on your system. I use heads for ones. What follows is a brief description of a method that uses 10 flips of a fair coin to generate a Chess960 position. It makes use of the Chess960 numbering scheme, explained in Wikipedia, and of the circumstance that 960=21026960=2^{10}-2^6. All positions are equiprobable as long as the coin is fair. I give an example with an arbitrary position that I refer back to in each step.


  1. Flip a coin 10 times and note the outcomes. Start over if your first 4 flips are heads. heads heads tails tails tails tails heads tails tails heads
  1. Use the result to retrieve a number AA in its binary representation. Heads are ones. The first flip is the most significant digit. 11000010012, equivalently 777
  1. Orient the board as seen by White. Prepare to place White’s pieces.
  1. Divide AA by 4, giving quotient BB and remainder CC. CC determines the square of the light-squared Bishop in reading order. quotient 194, remainder 1
    bishop on second empty white square (d1)
  1. Divide BB by 4, giving quotient DD and remainder EE. EE determines the square of the dark-squared Bishop in reading order. quotient 48, remainder 2
    bishop on third empty dark square (e1)
  1. Divide DD by 6, giving quotient FF and remainder GG. GG determines the Queen’s square in reading order. quotient 8, remainder 0
    queen on first empty square (a1)
  1. FF determines the Knights’ position on remaining squares, according to this scheme: 8
    knights on third and fifth empty squares (f1 & h1)

    This table is simply the list of permutations of the set ♘♘---, lexicographically ordered by {♘, -}.
    0 - - -
    1 - - -
    2 - - -
    3 - - -
    4 - - -
    5 - - -
    6 - - -
    7 - - -
    8 - - -
    9 - - -
  1. Place the King on the second empty square in reading order. king on second empty square (c1)

  2. Place Rooks on remaining squares. rooks on remaining squares (b1 & g1)

  3. Mirror the set-up for Black as you would in ordinary chess (e.g. King faces King).