The Qubble Booklet
Qubble is a tiny language: a handful of plain words that are real quantum gates. This booklet teaches it chapter by chapter. Every chapter is a complete little program — type it into the Studio (each one is short on purpose), press Run ▶, and watch the amplitude bars. You cannot break anything, and there is nothing to install.
1Hello, qubit
A qubit is the smallest piece of a quantum computer. When you make one, it starts out
as a definite 0. plot_state shows its amplitude bars — right now, one tall
bar on 0 and nothing on 1.
# Chapter 1 — your first qubit. q = qubit # make a qubit; it starts as 0 say "hello, qubit!" # print a message plot_state q # show its bars: all on |0>
flip q before
plot_state q — flip turns 0 into 1. Which bar is tall now?2Spin: make a blend
spin is the first truly quantum move. It puts the qubit into a blend of possibilities: part of it points at 0 and part points at 1, at the same strength. The bars show the blend directly — this is the state itself, not a guess.
Careful with words: the qubit is not “both 0 and 1 at once.” It holds a blend of amplitudes — and you can see exactly how much of each.
# Chapter 2 — a fair blend. q = qubit # starts as 0 spin q # now: half strength on 0, half on 1 plot_state q # two equal bars
spin q. Does the blend get
“blendier” — or does something surprising happen?3Measure: get one answer
measure asks the qubit a question: “0 or 1?” A blend must give one definite answer, and the tall bars are the likely ones. After measuring, the blend is gone — the qubit really is whatever it answered.
# Chapter 3 — a quantum coin flip. q = qubit spin q # a fair 50/50 blend result = measure q # ask: 0 or 1? say "the coin says", result
4Run it many times
One run gives one answer. To see the 50/50 hiding inside the blend, run it hundreds of
times and count. histogram does exactly that.
# Chapter 4 — see the pattern. q = qubit spin q # fair blend histogram q, shots: 200 # run 200 times and count 0s and 1s
shots: 200 to shots: 1000.
Does the split get closer to half and half?5Phase: the hidden dial
Every bar also has a phase — shown as its colour. phase flips the sign of the “1” part of the blend. The heights don’t change, so measuring looks the same… but the phase is about to matter a lot.
# Chapter 5 — flip the hidden dial. q = qubit spin q # fair blend plot_state q # look at the bar colours phase q # flip the sign of the 1 part plot_state q # same heights, different colour!
histogram q, shots: 200 at the end.
Can a measurement tell the difference? (Not yet…)6Interference: the cancel trick
Here is the heart of quantum computing. When paths agree in phase they add up; when they are opposite they cancel — like waves of light. Spin, flip the phase, spin again: the 0-parts add and the 1-parts erase each other. One bar remains.
This is where any quantum advantage comes from — not from “trying everything at once,” but from arranging the phases so wrong answers cancel and right answers add up. It only helps for some problems.
# Chapter 6 — the cancel trick. q = qubit spin q # blend phase q # flip the 1 part's sign spin q # paths meet: 0s add, 1s cancel plot_state q # one bar standing say "always:", measure q
phase q line and run again. Now the
paths meet differently — which bar wins this time?7Turn: partial spins
spin is all-or-nothing, but turn lets you choose the angle — a little turn makes a lopsided blend. That is how you make a coin that lands 1 only sometimes.
# Chapter 7 — an unfair coin. q = qubit turn q, by: 60 # a partial turn: mostly 0, some 1 plot_state q # one tall bar, one short bar histogram q, shots: 300 # count how often 1 shows up
by: 90 (that’s a fair blend) and
by: 180 (that’s a full flip). What does by: 30 give?8Two qubits
Two qubits have four possible answers: 00, 01, 10, 11 — so four bars. Spin both and all four light up equally. Each new qubit doubles the bars; that fast growth is why quantum states are hard for ordinary computers to imitate.
# Chapter 8 — four possibilities. a = qubit b = qubit spin a # blend the first spin b # blend the second plot_state # all four bars: 00 01 10 11
spin b. Which bars go dark, and why?9Link: qubits that agree
link ties two qubits together — this is entanglement. After linking, the pair has one shared state: measure them and they agree, every single time, even though each answer alone is random.
Honest note: entangled qubits are correlated, but you cannot use them to send a message. And a linked qubit has no little state of its own — only the pair does. Quave shows the pair’s bars for exactly that reason.
# Chapter 9 — the famous Bell pair. a = qubit b = qubit spin a # blend a link a, b # entangle: b follows a plot_state # only 00 and 11 remain histogram a, b, shots: 200 # they always agree
flip b after the link. Now what pairs do
you see — do they still move together?10Repeat: loops
repeat runs some lines several times. Handy for spinning many qubits, or for gates that build up an angle bit by bit.
# Chapter 10 — three small turns make one big one. q = qubit repeat 3 turn q, by: 30 # 3 turns of 30 = one turn of 90 end plot_state q # a fair blend, built in steps
repeat 6. 6 × 30 = 180 — which
single gate is that the same as?11Registers: many qubits at once
A register is a row of qubits with one name. reg[0] is the first,
reg[1] the next, and so on. Three qubits means eight bars.
# Chapter 11 — a row of qubits. reg = qubits 3 # three qubits: reg[0], reg[1], reg[2] spin reg[0] # blend the first link reg[0], reg[1] # tie the second to it link reg[1], reg[2] # ...and the third plot_state # a 3-qubit "all agree" state: 000 and 111
histogram reg[0], reg[1], reg[2], shots: 200
— three random bits that always match.12Share your demo
Built something you like? In the Studio, press Deploy to publish it to the Gallery. Anyone can press play, watch your amplitudes, and read every line — Quave demos have no secrets. Titles and descriptions are checked by our safety rules before they appear.
Accounts are just a username and password — no email needed, and never a real name. Learning never requires an account at all.
Physics wording on this page follows Quave’s honesty rules and is pending physicist review. Spot something confusing? Tell a teacher or parent to write to SenSym.