Code
qcr:2606.47125.1

Mermin-Peres Magic Square Game

The Mermin-Peres magic square game is a striking demonstration of quantum pseudo-telepathy: a cooperative game that two players, Alice and Bob, can win every single time using shared entanglement but can never win with certainty using any classical strategy, even with unlimited shared randomness. In the game, Alice is given a row of a 3x3 grid and must fill in three values of plus or minus one whose product is plus one, while Bob is given a column and must fill in three values whose product is minus one; they win only if their entries agree in the cell where the row and column intersect. The parity constraints make a consistent classical assignment impossible, capping the classical win rate below 100%, yet by sharing two Bell pairs and measuring commuting observables arranged in the magic square, Alice and Bob can satisfy every constraint simultaneously and win with probability one. This Cirq example builds the shared entangled state, implements the measurement strategy for each row and column, simulates repeated rounds, and confirms the perfect quantum win rate. It is a vivid, self-contained illustration of how entanglement provides correlations with no classical explanation.
Qubit
Circuit-based
Uploaded 3 days ago
18
Views
GitHub4990
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

quantumlib/Cirq
49901228
README.md

Mermin-Peres Magic Square Game

The Mermin-Peres magic square game is a striking demonstration of quantum pseudo-telepathy: a cooperative game that two players, Alice and Bob, can win every single time using shared entanglement but can never win with certainty using any classical strategy, even with unlimited shared randomness. In the game, Alice is given a row of a 3x3 grid and must fill in three values of plus or minus one whose product is plus one, while Bob is given a column and must fill in three values whose product is minus one; they win only if their entries agree in the cell where the row and column intersect. The parity constraints make a consistent classical assignment impossible, capping the classical win rate below 100%, yet by sharing two Bell pairs and measuring commuting observables arranged in the magic square, Alice and Bob can satisfy every constraint simultaneously and win with probability one. This Cirq example builds the shared entangled state, implements the measurement strategy for each row and column, simulates repeated rounds, and confirms the perfect quantum win rate. It is a vivid, self-contained illustration of how entanglement provides correlations with no classical explanation.

Run it

pip install -r requirements.txt
python magic_square.py

Source and license

Imported from examples/magic_square.py in quantumlib/Cirq at v1.6.1, under the Apache License 2.0. Original authors: The Cirq Developers. The upstream LICENSE is included alongside this example.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.

Versions

v1 Latest
Jun 15, 2026
qcr:2606.47125.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

Cirq

Keywords

magic-square
pseudo-telepathy
entanglement
nonlocality
bell-pairs

You may also like5