Practical guides to AI, computing, modelling, simulation, optimization and quantum computing, featuring hands-on tutorials, experiments and research.

CHSH Game Simulator: Bell’s Inequality and Quantum Entanglement

Part of the Quantum Computing: A Complete Learning Path series.
CHSH game simulator comparing classical and quantum entanglement strategies
QUANTUM SERIES 2026
Exploring Quantum Entanglement: CHSH Game Simulator

The CHSH game is a two-player experiment that demonstrates how quantum entanglement produces correlations impossible under classical physics. In this interactive CHSH game simulator, you can compare the classical maximum win rate of 75% with the quantum result of approximately 85.4%, explore all four Bell states, and see Bell’s inequality violated in real time.

🎮 Play the CHSH Game Simulator 📂 View Source on GitHub

1 · How to Play the CHSH Game

The CHSH (Clauser-Horne-Shimony-Holt) game is a cooperative thought experiment that reveals the strange power of quantum entanglement. Two players, Alice and Bob, cannot communicate during the game but may share a pre-agreed strategy or, crucially, a pair of entangled qubits.

  1. The referee gives Alice a random input bit x and Bob a random input bit y.
  2. Without communicating, Alice returns a and Bob returns b.
  3. They win when a ⊕ b = x ∧ y: their answers match unless both input bits are 1.
  4. Repeat many rounds and compare the classical and quantum win rates.
Player Receives from referee Outputs
Alice Random bit x Bit a
Bob Random bit y Bit b

They win if and only if:

(a + b) mod 2 = x × y
With classical strategies, Alice and Bob can win at most 75% of the time. With a quantum strategy using entangled qubits, they can reach approximately 85.4%, violating the classical bound.

Worked example: one CHSH round

Suppose the referee sends x = 1 to Alice and y = 1 to Bob. Their winning condition is a ⊕ b = 1, so their output bits must differ. If Alice answers a = 0 and Bob answers b = 1, then 0 ⊕ 1 = 1 and they win the round.

2 · Classical vs Quantum CHSH Strategies

In 1964, John Bell proved that no local hidden variable theory can reproduce all predictions of quantum mechanics. The CHSH inequality formalises Bell’s theorem as a single testable number S:

Theory CHSH Value (S) Win Rate
Classical (any local strategy) S ≤ 2 75%
Quantum mechanics S = 2√2 ≈ 2.828 ~85.4%

Why is the quantum CHSH win rate 85.4%?

The optimal quantum strategy wins with probability cos²(π/8) = (2 + √2) / 4 ≈ 0.8536. Carefully chosen measurement angles turn entanglement into correlations stronger than any local classical strategy can produce.

This violation is not a loophole or a trick. It proves that the correlations produced by entangled qubits cannot be explained by any shared classical information, even with pre-agreed randomness. Loophole-free Bell test experiments confirm that quantum entanglement is a genuine physical phenomenon with no classical analogue.

3 · Measurement Angles and Quantum Correlation

The quantum advantage arises from choosing measurement bases at specific angles. For the standard |Φ+⟩ Bell state, the optimal angles are:

Player Input bit Measurement basis
Alice x = 0
Alice x = 1 45°
Bob y = 0 22.5°
Bob y = 1 −22.5°

The probability that Alice and Bob produce the same outcome is:

P(same) = cos²(δ)

where δ is the angle between their chosen measurement bases. This quantum correlation is what enables them to exceed the 75% classical ceiling. Different Bell states exhibit either parallel correlation (|Φ+⟩, |Ψ+⟩: qubits tend to give the same outcome) or orthogonal correlation (|Φ−⟩, |Ψ−⟩: one qubit effectively rotated 90° relative to the other). The simulator adjusts its probability calculations accordingly for each state.

🧪 4 · The Four Bell States

The simulator supports all four maximally entangled Bell states. Each uses optimised measurement angles to achieve the theoretical quantum win rate of ~85%.

State Definition Correlation
|Φ+⟩ (|00⟩ + |11⟩) / √2 Parallel
|Φ−⟩ (|00⟩ − |11⟩) / √2 Orthogonal
|Ψ+⟩ (|01⟩ + |10⟩) / √2 Parallel
|Ψ−⟩ (|01⟩ − |10⟩) / √2 Orthogonal

🎯 5 · CHSH Game Simulator Features

Feature Details
🎯 Interactive Visualization Real-time p5.js visualization showing the entangled state, Alice’s measurement collapse, and Bob’s final measurement. Coloured basis quadrants and correlation indicators included.
🎮 Strategy Comparison Switch between Classical (always outputs 0, max 75%) and Quantum (entangled qubits, ~85.4%) strategies in real time.
🎲 Flexible Input Controls Set Alice’s x and Bob’s y to Random or Fixed (0 or 1) to test specific measurement configurations.
📊 Real-Time Statistics Running totals for rounds played, wins, losses, and win percentage converging toward theoretical predictions.
🔄 Round History Navigation Step through previous rounds to review specific outcomes and trace the quantum measurement process.
Built with: React, p5.js, and Claude Code

6 · Try the Quantum Entanglement Simulator

A suggested sequence to build intuition:

  1. Open the simulator and select the Classical strategy. Run 100 rounds and watch the win rate converge toward 75%.
  2. Switch to the Quantum strategy with the |Φ+⟩ Bell state. Run another 100 rounds and observe the rate climb toward 85%.
  3. Try the other three Bell states. Note how each state’s correlation type (parallel vs orthogonal) affects the outcome distribution.
  4. Set Alice and Bob’s inputs to Fixed values to test individual measurement configurations and trace the correlation manually.
  5. Use Round History to step back through specific rounds and verify the win condition (a + b) mod 2 = x × y by hand.

7 · Open Source Code on GitHub

The complete source code is on GitHub. Contributions welcome: explore the code, report issues, suggest improvements, or fork it to build your own quantum visualisations.

Planned enhancements include a 3D Bloch sphere visualisation (Three.js), step-by-step animated transitions, an in-app educational tutorial, a mathematical deep-dive panel, and improved mobile layout.

The CHSH game demonstrates that quantum entanglement is not a mathematical abstraction but a measurable, observable phenomenon with no classical analogue. This simulator makes that phenomenon interactive and accessible to anyone curious about quantum mechanics.

Further reading


QUANTUM SERIES 2026 · Quantum Entanglement and Bell Inequalities

✦ This article was generated with the assistance of Claude by Anthropic

About the author

Malcolm Low is an Associate Professor at the Singapore Institute of Technology, writing on quantum computing, programming, and applied computing from Singapore.

Website: malcolmlow.com  ·  Singapore

Frequently Asked Questions

What is the CHSH game?

The CHSH game is a thought experiment used to test Bell’s inequality — two players, unable to communicate during the round, try to win a coordination game more often than classical physics allows, using entangled qubits shared in advance.

What is Bell’s inequality?

Bell’s inequality sets an upper limit — 75% — on how often two players can win the CHSH game using any classical (non-quantum) strategy, no matter how cleverly they coordinate beforehand.

Can quantum entanglement really beat 75% in the CHSH game?

Yes — using entangled qubits and the right measurement angles, quantum strategies can win roughly 85% of rounds, provably exceeding the classical limit set by Bell’s inequality.

Why does the CHSH game matter for quantum computing?

It’s one of the clearest experimental demonstrations that quantum mechanics behaves fundamentally differently from classical physics, and the same entanglement principles underpin many practical quantum algorithms.

Continue the Quantum Series

Where entanglement goes next: See how shared entanglement enables quantum teleportation without cloning a qubit.

Comments

4 responses to “CHSH Game Simulator: Bell’s Inequality and Quantum Entanglement”

  1. Quantum Computing: A Complete Learning Path – Techucation Avatar

    […] surfaces the marked item. 5  ·  Entanglement and Bell’s Inequality 12 The CHSH Game Simulator and Bell’s Inequality An interactive game where quantum entanglement beats the classical 75 percent ceiling and violates […]

    Like

  2. Quantum Teleportation in Quantum Computing, and Why It Isn’t Cloning – Techucation Avatar

    […] Related interactive experiment: Teleportation uses entanglement as a resource. See the same nonclassical correlations tested directly in the interactive quantum entanglement game. Play and learn with the CHSH game. […]

    Like

  3. The No-Cloning Theorem in Quantum Computing: Why You Can’t Copy a Qubit – Techucation Avatar

    […] Related interactive experiment: The no-cloning theorem limits what quantum information can do; entanglement reveals what it can do. Explore the contrast with this Bell’s inequality simulator. Play and learn with the CHSH game. […]

    Like

  4. Introduction to Quantum Computing: Qubits, Hadamard Gates, and Superposition – Techucation Avatar

    […] Related interactive experiment: Ready to see entanglement outperform classical physics? Try the CHSH game simulator and compare the 75% classical limit with the 85.4% quantum strategy. Play and learn with the CHSH game. […]

    Like

Leave a comment