Jump to navigation Jump to search
Quantum brainfuck is an esolang by Ihope127 which is essentially brainfuck operating on qubits instead of integers. The tape starts initialized with all 1's. The commands:
< Move the tape head left. > Move the tape head right. % Perform the Hadamard transform on the current qubit. ! Perform a controlled-V on the current qubit and the one to the right of it. & Swap the current qubit with the one to the right of it. , Input to the current qubit. . Output the current qubit. [ While observing the current qubit gives a 1... ] End while.
The controlled-V gate acts as identity, unless both the control and the target are 1, in which case they are multiplied by the imaginary unit before being returned. Output works using a CNOT, so that the output qubit and the qubit on the tape are entangled.
Controlled-V as a matrix:
[1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 i]
- An implementation by User:lament, written in Python, is currently available:
- Quantum computers on Wikipedia