A quantum computing twist on classical chess β where pieces exist in superposition, captures trigger real quantum measurements on IBM hardware, and entangled pieces always collapse together.
CS5331/4331 β Introduction to Quantum Computing | Texas Tech University
- Overview
- Quantum Mechanics Used
- Novelty Statement
- Tech Stack
- Project Structure
- Team
- Installation
- IBM Quantum Setup
- How to Play
- Quantum Circuits
- Development Timeline
- References
Quantum Chess extends classical chess with three quantum mechanics:
- Superposition β a piece can occupy two squares at once until observed
- Collapse / Measurement β attempting to capture a superposed piece triggers a real quantum measurement on IBM hardware; the piece collapses to one square (or disappears if it wasn't there)
- Entanglement β two pieces can be linked via a Bell state so that their collapses are always correlated
The result is a game where uncertainty is a first-class mechanic, not a gimmick and where the randomness comes from actual quantum hardware, not a pseudo-random number generator.
| Mechanic | Gate | Game Event |
|---|---|---|
| Superposition | Hadamard (H) |
Superposition move β piece splits across two squares |
| Entanglement | CNOT (CX) |
Entangle move β two pieces linked into a Bell state |
| Measurement / Collapse | Measure |
Capture attempt β collapses piece to one square |
Unlike Google's Quantum Chess (SplitInfinity), which uses a classical chess engine with quantum-inspired rules, our version performs real quantum gate operations (H, CNOT, Measure) on IBM Quantum hardware for the two most critical game events: piece collapse and entanglement resolution.
The collapse mechanic is a genuine quantum measurement β not a simulation. This makes Quantum Chess a pedagogical quantum computing demo embedded in a game, not just a game with quantum-flavored rules.
| Component | Tool | Purpose |
|---|---|---|
| Quantum backend | Qiskit + IBM Quantum Runtime |
Real H, CNOT, Measure gates on hardware |
| Quantum simulator | Qiskit Aer |
Fast local fallback for dev and demo |
| Game logic | Python (custom) | Chess rules + quantum rule extensions |
| UI / Rendering | Pygame | Board, ghost pieces, collapse animations |
| Circuit diagrams | IBM Quantum Composer | Presentation slide visuals |
quantum_chess/
βββ quantum_engine.py # Qubit state management, H gate, CNOT, measurement
βββ entanglement.py # Bell state creation, correlated collapse logic
βββ board.py # Classical board state, piece positions, move rules
βββ quantum_rules.py # Superposition move, entangle move, measure move
βββ game_manager.py # Turn flow, win condition, event orchestration
βββ renderer.py # Board drawing, ghost pieces, collapse animations
βββ ui_components.py # State panel, move history, quantum event log
βββ main.py # Entry point, game loop
| Member | Role | Owns |
|---|---|---|
| Lavneet Hora | Quantum Backend | quantum_engine.py, entanglement.py |
| Luis Baeza | Game Logic | board.py, quantum_rules.py, game_manager.py |
| Joshua Longoria | UI & Visualization | renderer.py, ui_components.py, main.py |
Week 1 priority: All three members must agree on the piece representation below before writing any module code. This is the contract that lets all three workstreams run in parallel.
# Shared piece representation
piece = {
"type": "knight",
"color": "white",
"positions": ["e4"], # classical: one square
# OR
"positions": ["e4", "g5"], # superposition: two squares
"superposed": True,
"qubit_id": 3, # index into the quantum register
"entangled_with": [7], # qubit IDs of entangled pieces (if any)
}- Python 3.9+
- Node.js (optional, for any JS tooling)
- A free IBM Quantum account
pip install qiskit qiskit-ibm-runtime qiskit-aer pygamepython main.pypython quantum_engine.py # Tests superposition + measurement
python entanglement.py # Tests Bell state creation
python board.py # Tests classical chess rulesfrom qiskit_ibm_runtime import QiskitRuntimeService
QiskitRuntimeService.save_account(
channel="ibm_quantum",
token="YOUR_IBM_QUANTUM_TOKEN" # from quantum.ibm.com β account settings
)Running every move on real hardware is impractical due to queue times. We use a hardware toggle:
| Game Event | Backend | Reason |
|---|---|---|
| Regular moves | Classical (instant) | No quantum needed |
| Superposition move | Qiskit Aer | Fast, no queue wait |
| Capture of superposed piece | IBM Real Hardware | Showcase moment β genuine randomness |
| Entanglement collapse | IBM Real Hardware | Demonstrates Bell state |
| Live demo / presentation fallback | Qiskit Aer | Reliable under time pressure |
USE_REAL_HARDWARE = False # Set True for showcase moments
def measure_qubit(circuit):
if USE_REAL_HARDWARE:
service = QiskitRuntimeService(channel="ibm_quantum")
backend = service.least_busy(operational=True, simulator=False)
else:
from qiskit_aer import AerSimulator
backend = AerSimulator()
from qiskit_ibm_runtime import Sampler
sampler = Sampler(backend)
job = sampler.run([circuit], shots=1)
return job.result()All classical chess moves are valid. The game follows standard FIDE rules for non-quantum moves.
| Move | How to trigger | What happens |
|---|---|---|
| Superposition move | Select a piece, then select two destination squares | Piece enters superposition β shown as ghost pieces on both squares |
| Entangle move | Select two of your own pieces | Pieces become entangled β shown with a glowing link |
| Measure move | Select any superposed piece | Forces immediate collapse to one square |
- Capturing a classical piece works as normal.
- Capturing a superposed piece triggers a quantum measurement:
- If the piece collapses to the captured square β capture succeeds
- If the piece collapses to the other square β capture fails, piece survives
- When one entangled piece collapses, the other collapses simultaneously.
- Their outcomes are correlated β if A collapses to its primary square, B collapses to its primary square too (Bell state
|00β©or|11β©, never|01β©or|10β©).
from qiskit import QuantumCircuit
qc = QuantumCircuit(1, 1)
qc.h(0) # |0β© β |+β© = (|0β© + |1β©) / β2
qc.measure(0, 0) # Collapses to |0β© or |1β© with equal probabilityq_0: ββ€ H βββ€Mβ
βββββ ββ₯β
c: 1/βββββββββ©β
0
qc = QuantumCircuit(2, 2)
qc.h(0) # Piece A in superposition
qc.cx(0, 1) # Entangle piece B with piece A β Bell state |Ξ¦+β©
qc.measure([0,1], [0,1])
# Result is always |00β© or |11β© β never |01β© or |10β©q_0: ββ€ H βββ βββ€Mββββ
βββββ β ββ₯ββββ
q_1: ββββββββ€Xββ¬β«ββ€Mβ
βββββ ββ₯β
c: 2/ββββββββββββ©βββ©β
0 1
Demo talking point: Show your audience that entangled pieces always collapse together (00 or 11, never 01 or 10). This is the Bell state in action on real IBM quantum hardware β not a coin flip.
| Week | Goal |
|---|---|
| 1 | All three members agree on the shared data contract. No module code yet. |
| 2 | A: superposition + measurement working. B: classical board + legal moves. C: static board renders. |
| 3 | Integration sprint β A+B connect quantum events to game logic. C pulls live state from B. |
| 4 | All quantum rules working. Ghost pieces + collapse animations in UI. IBM Quantum integration tested. |
| 5 | Bug fixing, edge cases, demo polish. Presentation prepared and rehearsed. |
- IBM Quantum Composer
- Qiskit Documentation
- PennyLane β alternative quantum backend
- Quantum Odyssey / Quantum Chess (SplitInfinity) β original inspiration
- Nielsen & Chuang β Quantum Computation and Quantum Information, Ch. 1β2
- Course material: CS5331/4331, Texas Tech University