Leo’s FLG (Focused Learning Goal) for this year* is to build a real quantum computing mod in MineCraft. (Note that the kids set these goals for themselves at the beginning of the year, and although I might have slightly influenced his choice of project, the “in MinceCraft” setting was all Leo!) This came from several sources, aside from just the obvious entanglement of his interest in quantum computers with MineCraft. The main influence is that there are two quite cool MineCraft mods, one, called qCraft, that adds a sort of quasi-quantum mechanics, and another, called Mekanism, that adds all sorts of advanced devices, esp. lasers. The qCraft mod actually has quantum computer components, but they are not very elegantly done; We wanted to make it a little more like a real quantum computer by using the Mekanism lasers as the qubit sources, and then add optical components for the gates.
If you don’t know what I’m talking about, there are innumerable videos on quantum computation on youtube, but if you REALLY want to understand it, I strongly recommend this excellent set of short lectures by Michael Nielsen, which not only nicely demystifies quantum computers, but at the same time demystifies quantum mechanics!
Anyway, so we needed to get our feet a tiny bit wet toward this pretty massively complex FLG. Unfortunately, direct MineCraft modding is done either in Java or Python. (There are a few little experiments in modding in scratch-like languages, but, much as they are nice tries, they have issues, so I decided not to bother with them, at least for the moment.)
To get our feet wet using a programming paradigm that Leo already knows, we chose HopScotch. Together we created a highly simplified quantum computer game in HopScotch. We only have one gate, a Hadamard gate, and the quantum state is highly simplified, having only the possibilities of being 1 or 0 or 50/50, no complex numbers nor normalizations.
But it’s kinda cool, none-the-less:
The circle represents a qubit that might be a photon, for example, and its color represents its quantum state: green is definite 1, and red is definite 0. It travels a continuous loop from left to right, and then re-appears on the left again, as though it’s on a quantum wire that’s looped around from the end to the start.
When the program starts, the photon’s quantum state is definite 1 (1.0|1>+0.0|0>), and so the photon is green. The M box on the right measures the quantum state, “collapsing” it to 1 or 0. If you just let the program run from the start without doing anything, the measurement gate will just keep reading 1, and incrementing the 1 count. The photon will just stay green.
The hex is a Hadamard gate (H gate), which splits the quantum state in half ((0.5|1>+0.5|0> — remember that we’re simplifying here, so there are no complex values or normalizations). If you drag the hex into the photon’s path (righthand screencap), the state becomes a mixture of 1 and 0 (and a mixture of red and green). When a qubit in that 50/50 state gets measured, there’s a 50/50 chance of collapsing into a 1 or a 0, and if you
You can try it out yourself on HopScotch on your iPad. (I’m told that HopScotch now allows you to run code in your browser, so you don’t need to actually have HopScotch on an iPad, although I highly recommend HopScotch on an iPad!)
* This post was actually written when Leo was in 3rd grade, so over a year ago. I apparently forgot to publish it, and it has been lingering in the drafts folder! Better late than never.