Example: Quantum Coin Game
The game is played with a quantum coin, which is in a superposition of heads and tails.
Alice - Quantum Computer Bob - Opponent(Human)
heads = |0> tails = |1>
The rules are simple:
- Alice places the coin in a state of her choice (heads or tails on top) in a box that covers the coin. Even by touching the coin, it is impossible to determine which side is up.
- Bob reaches into the box and has the choice to flip the coin over or not. Alice cannot see what he is doing.
- Alice reaches into the box and performs an operation of her choice (flip or not flip).
- The coin is uncovered and the result is read.
- If its heads, then Quantum Computer wins. Else, Opponent(Human) wins.
Important: Alice and Bob don't know the result of the coin until it is uncovered.
The game is implemented using quantum.js.
import { getQuantumCoinGameResult, quantumCoinGame } from 'library';
const res = quantumCoinGame(false);
console.log(getQuantumCoinGameResult(res));
Output
Quantum Computer wins