Part I: Quantum Chess
(github repo)

Now, before I get any snarky replies, I know that "quantum chess" is a bit of a misnomer. Chess is already quantum! Like most modern pop-science uses of the word, I am of course using it to describe a chess variation that implements superposition of game states, but "superpositional chess" just doesn't roll off the tongue like Quantum Chess does. If you have a better idea for a name, let me know.

The idea is simple: in a standard game of chess, each of the two players take turns making a single move each turn. The same is true of quantum chess, except that a player has the option to, instead of moving a piece to a specific square, place a piece in a superposition of all possible moves that that piece could have made. Future moves will eventually reveal that there is only one space that the piece could have moved to for the sequence of moves to be legal, at which point the waveform collapses upon that move.

To give a simple example, I will employ a Python program I wrote to visualize such a game, which I will explain later on.

White's first move is to place their knight in superposition. Every move that the knight could have made is highlighted in magenta. Black replies with e5, but it doesn't matter for the sake of this example.

White then plays c4, which is only a legal move if Nc3 was not played. Since the only other move that could have been made was Na3, the state of that knight collapses upon that move.

Some clarification on the rules:
    Placing a piece in superposition means it must simultaneously inhabit all possible destination squares. You can't just pick a few.

    Pieces must be moved or superpositioned from a known source square. You can't "double superposition" a piece by claiming it has moved twice from some square.

    Technically, it is game states that are being placed in superposition, not pieces. This means that a king could theoretically be in a superposition between moving up and castling, for example, or perhaps a pawn could be in a superposition between all its possible promotions.

What I find fascinating about this game is twofold: firstly, the fundamental rules of chess are unaltered. At the end of a game of quantum chess, after every piece's eventual location is known, the game can be replayed from the beginning and will consist only of standard, legal chess moves. Secondly, because of the fact that the game's fundamental rules are unaltered, some variation of this could be applied to any turn-based, shared-information game with no element of chance.

Before I realized the second point, I tried writing a software implementation that sought to describe pieces in superposition as some sort of strange meta-pieces on a single board that would either resolve to real pieces of end up being annihilated when their twin was resolved, but this was horribly cumbersome, slow, and inelegant. Around refactor no. 3 I realized that I could simply simulate chess normally, but place the entire game state in a superposition. The resulting code was comically simple once I resorted to using a standard chess engine library as a base. Most of it ended up just being the ASCII visualization.

If a superposition is played, the game state is cloned and a new branch is made for each move that could have been made. Every time a subsequent move is made, the move is attempted in all branches. If that move is illegal in that branch, the branch is culled. It would seem like this would result in exponentially ballooning game states in memory, but the fact that each superpositioned piece's start square must be known means that even in a superpositionally-heavy game, only a few hundred states are active at once in the worst cases.

You can download and play it yourself here:

The emergent meta of such a game is also fascinating! It would seem like such a ruleset would make queens and rooks even more powerful than they already are; being able to superposition pieces effectively renders you able to save a move for later, then move twice at once. For a piece like a queen, this can be very powerful.

In this example, white has decided to trade their bishop for black's knight in the Ruy Lopez, and then castles kingside.

To reply, black could choose to place their queen in superposition; this potentially allows black to reach nearly anywhere on the board on their next turn! White's pawn on e4 is vulnerable to be captured, and cannot be immediately defended against by white's knight. (Note: the notation on d2 indicates that that square contains either black's queen or white's pawn.)

White could attempt to capture the queen by entering the queen's probability field, but this is futile! In one possible universe, the queen could have moved to where the white knight now sits, but that move does not prove that the queen couldn't have moved somewhere else.

The queen takes advantage of this blunder and captures white's knight for free. White replies, cheekily, by superpositioning their own queen.

Black, sensing trouble, quickly escapes to the ether by superpositioning their own queen—there is nothing now white's queen can do to capture black's. It's a bit of a mess to look at, I know.

Now THIS is where things get really interesting. There is a special property of a certain unappreciated piece that destroys black's effort to escape... (Here's where I'd suggest you pause the video and see if you can figure it out for yourself.)

For those of you who got it, congratulations! The winning realization is this:

Pawns can only move diagonally when capturing.

White plays hxg3, which immediately collapses the probability field on black's queen having moved there. Since white's pawn could only have moved diagonally if it captured a piece on its destination square, black's queen necessarily MUST have moved to g3 for the game to remain legal. Thus, black's queen is captured from its superposition my quantum chess's most powerful piece: the pawn. (You may also notice that there is now a chunk missing from white's probability field—this is because black's queen moved through it on the last turn, necessitating that the white queen could not have moved there.

Because of this oddity, pawns end up being the most powerful piece in the game. Haphazard superpositions are immediately punished by pawn captures, so moves must be carefully planned so that probability fields are not in the line of fire of pawns. There are a few other interesting side effects I've discovered while playing this with friends:
    If a piece is superpositioned in such a way that some, but not all possible destination squares place the opponent in check, those possibilities will be culled if the opponent elects on their next turn not to move their king, since you cannot leave your king in check.

    If a piece besides a pawn moves into an opposing piece's probability field, the opponent can simply move their piece from a different ending location to keep it alive. If they don't do that in time, it's possible to kill the piece forever by trampling the rest of the probability field on subsequent turns by pieces of any color, thus requiring that the piece must have been taken at some point.

    If there are no pieces on your base rank besides your king and both rooks, it's possible to put your king in a superposition between all its cardinal moves as well as both castles, all at once.

    A pawn in superposition from its starting square is very powerful. It can effectively cover four possible squares at once, each delivering a killing blow if an opposing probability field gets too close.

    Pieces besides pawns can "un-superposition" by moving back to the square they came from.

Note: While writing this section, I realized that I can make this game even more interesting by truly bringing it in parallel with Heisenberg's uncertainty principle. My existing implementation of superposition is just that: the knowledge that a specific piece has moved, but no knowledge of where. The obvious opposite to this would be to know precisely where a piece has moved to, but not which one. I'm going to change the rules so that only one of two moves can be made:
    a) A move from a known square to an unknown one

    b) A move from an unknown square to a known one

This is much more elegant. This will leave the game largely unchanged—most squares only have one piece that can move to them at a time, so the waveform will collapse as soon as it is created. But there will be some instances where that is not the case, and I will explore them as soon as I implement it!

Part II: Many-Worlds Solitaire

The chief problem with quantum chess is this: no one wants to play it with me. It's simply too ridiculous to explain to most, and can't really be easily played on a standard chessboard. As with most of my strange fixations, I am relegated to enjoying them in solitude.

The idea is simple: I want to play an opponent in a derivative variation of quantum chess that instead of having some complex game-tree search algorithm or AI cooking up moves, I simply play an opponent that, each turn, plays every single move it can legally make.

I visualize this by displaying a board that only shows my pieces and not my opponent's—my opponent's pieces' probability fields quickly spread across the entire board like a virus. White (the player) can only make normal chess moves, and loses whenever they are in checkmate in ANY active game state in superposition.

The advantage of this is that it is deterministic, and therefore a true solitaire; no decisions must be made on behalf of the opponent. The disadvantage is that unlike normal quantum chess, the game states really do balloon, and quickly.

It's also pretty hard to lose, and yet-unclear how to win. I've verified that it works (by playing the fools mate, I am notified that I have been checkmated) but I haven't gotten checkmated any other way. One apparent weakness of such a game is that there is no clear way for white's pieces to end up being captured. For a piece to be captured, it would have to be taken in every single possible universe—by moving it, white culls the multitude of states where the piece had been captured.

I am very intrigued by the idea of a chess-based deterministic solitaire, but I need ideas for rules that make white more adversarial. Any ideas? This isn't really a clean ending to this post, but it's all I've got! :p
To make the solitare more interesting, you could start off your pieces in a random configuration, with material being a rough difficulty meter? Like, chess960 on steroids, you could get 3 light squared bishops and a king.
Also, to be more interesting/difficult, you could have an option to collapse on "good" superpositions, such as ones with hanging pieces, for the opponent, almost allowing it to cheat.
Shading the squares in solitare mode depending on how "covered" they are is another idea.
I am super interested in this, might fork the code and play with it.
Super cool overall, can't wait to see what's next!
This idea has very much nerd-sniped me (and during a math conference no less), and in particular I've been thinking about how strong of a move superpositioning actually is. See, many players and theorists of this project's spiritual cousin, 5-D Chess with Multiversal Time Travel, came to conclusion that one of the best strategies is to just... play regular chess. Time travel is simply not powerful enough, and branching universes is more likely to lead to a loss you just didn't see coming.

But superpositioning seems to not quite "explode" the game tree so much as to prevent the move being useful. It's also (usually) obvious when superpositioning is bad, thanks to the strength of pawns and the fact that bishops, rooks, and queens are bound to get in some pawn's line-of-sight, particularly in the opening and midgame. Players would quickly get good at noticing these lines.

This leaves knights as the most interesting pieces for quantum tactics, due to having at most eight legal moves at any given time. For example, just as knights are often the best at delivering a fork, they are also the best at delivering a quantum fork. Here's a fun example on lichess' board editor (which I'll be using for all other examples since the repo isn't (yet) that friendly to custom board states).

The quantum fork in this example is qNc3, quantum fork the black queen and rook. It's also attacking both pieces in more than one way, meaning attempts to block only one capturing superposition will fail! The rook on e5 can do it though, via Rb5 or Re2, as this both captures one of the superpositioned knights and blocks the other one from having moved.

Knights are also great for quantum checkmate: all superpositions having the king in check. Here are two example: the first has qNh4#, relying on the knight being on the edge of the board (and thus requires a pretty unrealistic trap for the black king), while ths second uses white's own pieces to force the knight into attacking the king in the corner via qNe5# (and is thus at least slightly more plausible as an actual game state).

Of course, to get to the end of the game, you've got to start it, so the next thing I want to do is explore opening theory, and perhaps even get a rudimentary engine going. Your observation about superpositioned pawns probably turns most "classical" theory on its head. Hopefully there are some fun opening traps.
While I was wondering about whether superposition can deliver checkmate, I didn't come to ask how superposition can evade checkmate until this morning. The king gets quite slippery if in superposition, so let's look the "elementary" endgames to see if they still hold up:
    Queen: Though the enemy king can delay deciding where they've moved, the queen is still able to always restrict the king to a corner of the board. Her own king can then be used to protect her, so that the box can be contracted one rank or file at time.

    Two Rooks: Same deal; the rooks can work together to shrink the enemy king's available squares, regardless of superpositional threats to escape.

    Two Bishops: Ditto the previous two.

    One Rook: Impossible! This checkmate requires the friendly king to restrict the enemy king's escape past the rook during each contraction, but one king can't cover a quantum king in the same way.

    Bishop + Knight: Impossible as well. This mating pattern is tricky enough as it is, but superposition makes forcing the king to the right square completely untenable.

There are, of course, far more endgames worth looking into, ones which in classical chess cover entire Wikipedia articles. The analysis here gets pretty messy without an engine of some kind, though there are still cases where it's easy to see that superposition leads to new draws. It seems to be rare for superposition to enable new wins, as the enemy almost always has the ability to force the collapse of unfavorable universes (usually by ignoring check).
This is a very intriguing project! I would love to mess around with this~
I am also going to show it to my brother, who is much more of a chess nerd than I am :3
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum