Race against a quantum algorithm

Think you have what it takes to beat a quantum computer?


In the following game, your goal is to get the highest score possible, faster than the quantum computer. Once you click START RACE, you can click the circles of a graph to change their color. You get one point for every pair of connected circles with non-matching colors. When you're confident you've got a good score, click FINISH RACE, and see how you fared against the quantum computer!

   1 point
   no points
   no points

Difficulty (2 to {{maxSize}}):    

Please enter a number between 2 and {{maxSize}}

Generated Graph ({{getSeconds(data.userTime)}})

Quantum Virtual Machine (QVM) ({{getSeconds(data.compileTime)}})

Quil code for this graph has been created:


The Quil code generated in the previous step has now been compiled into a {{graphSize}}-qubit program.

After {{data.iterations}} iterations of the classical optimizer and classical subroutine, an answer has been found for the max cut of this graph.

The quantum algorithm has completed execution in {{getSeconds(data.compileTime)}}.

Unfortunately an error has occurred on our servers. Please try again.

Time and Score Results
You: {{graph.score()}} point{{graph.score() != 1 ? 's' : ''}} {{getSeconds(data.userTime)}}
QVM: {{data.score}} point{{data.score != 1 ? 's' : ''}} {{getSeconds(data.compileTime)}}
Best possible: {{maxScore}} point{{maxScore != 1 ? 's' : ''}}

Possible Answers

Above is a chart of the probabilities of each of the different graph colorings that the quantum computer was considering, represented as a wavefunction. The quantum algorithm sets up a superposition over all of the possible colorings of the graph, runs the algorithm, and ends with the following probability distribution for the best colorings. Try moving your mouse over the graph and observe how the coloring changes!
Waiting for the quantum computer to finish...


A maximum cut is a separation of a graph into two parts (e.g., teal and pink) that maximizes the number of lines between the two parts. Finding the maximum cut of a graph is an important problem in fields like electronic circuit design, statistical physics, and machine learning (see here), but it's intrinsically difficult for today's computers to solve. Rigetti's quantum computers may soon be able to find close-to-optimal solutions faster than today's computers by using the Quantum Approximate Optimization Algorithm (QAOA). In this game, we aim to give you a sense of the difficulty of the problem and the approximate nature of the QAOA.

Interested in learning more? Read the documentation and begin developing with Forest.