Shuffle Chess


Play it here →

This is a fun post. No lessons, no benchmarks.

When I get bored, I like to build slightly crazy things. This is one of them. Of course, I built it with Claude. But it is fun, and that is the whole point. I plan to post a lot more fun stuff like this.

The idea

Every chess game starts from the same position. So what if it did not?

The pawns stay where they are. The pieces behind them get shuffled. Each time you press “Shuffle”, you get an army you have never seen before. Your queen might be in the corner. Your knights might be next to your king. Your opening book is now useless. Good luck.

A few rules keep it from getting silly:

  • The bishops go on opposite colors. Otherwise one bishop is useless.
  • The king goes between the two rooks. So you can still castle.
  • The pawns do not move. The wall stays up.

Bobby Fischer got there first

Of course, someone had this idea before me. Bobby Fischer proposed it in 1996. It is called Fischer Random, or Chess960, because those rules allow exactly 960 starting positions. It is now an official variant with its own world championship. Position number 518 is the normal chess setup.

My twist: each side gets its own shuffle

In Chess960, Black’s pieces mirror White’s. In my version, White and Black each get their own shuffle. The two armies do not match.

That turns 960 positions into 960 × 960 = 921,600. Is it fair? Not always. Do I care? Not really. It is a game to play with a friend on a Sunday, not a tournament. If you want the classic, fair version, there is a “Mirror sides” switch.

The tricky bit: castling

Shuffling pieces is easy. Castling is where things get weird.

In Chess960, after castling, the king and rook land on the same squares as in normal chess. The king goes to g1 or c1, and the rook goes to f1 or d1. Depending on the shuffle, the king may jump five squares, or not move at all while only the rook moves.

Most chess code does not expect this. My first version got it wrong. So the game now has its own small rules engine that handles it. We checked it against published move counts for known test positions, and they all match.

Play it

Play Shuffle Chess →

Grab a friend and share one screen, or play the computer. The computer is Stockfish, the strongest chess engine around, running right in your browser. It has Easy, Medium and Hard levels. Hard will crush you. Press “Shuffle” and see who panics first. To castle, move your king onto the rook you want to castle with. “Copy link” saves the exact starting position, so you can send a friend your favorite disaster.

More fun stuff soon. 🙂