# How to use the input gates in Quirk

Strolling around I came across Craig Gidney's Blog and his awesome tool Quirk. I proceeded to read this interesting post of his where he alludes to the difference between actually measuring qubits in circuits and simply conditioning some part of the circuit to state of qubits. Long story short, he provides this Quirk circuit to experiment with. There he has a gate that is called "x499" and my question is:

How do I make this gate or any other of the input gates? (Those that feature an "A" or "B") I have spent a good amount of time dragging and dropping and clicking around but I seem unable to figure this functionality out. (* ashamed *) If I drag it into my circuit, it will turn yellow and show something like "input A needed".

The input gates are in the bottom toolbox, near the center:

If you place an input gate in the same column as an arithmetic gate requiring that input, they will link together into a combined operation:

You can also precede the input-requiring gate with a classical setting of the value:

Separating the input and the target into separate boxes makes using arithmetic much more flexible than it otherwise would be. In an older version they were combined into a single gate, and it was just generally a giant hassle to get anything lined up.

The "x499" gate in the circuit you linked is a custom gate:

Specifically, it is a "Circuit Gate" which was made by clicking the "Make Gate" button and then entering a range of the (at creation time of the gate) current circuit to include in the gate.

Notice that there is in fact a series of custom gates in the before-last screenshot. Each is including a handful of copies of the previous one, in order to build up to many many applications of the "apply Hadamard and controlled increment" operation. This is a workaround for the fact that Quirk has no concept of a loop.

Be aware that custom gates are by far the weakest part of Quirk's user experience. They're clunky to make, impossible to delete without editing the URL, don't have large enough thumbnails... it's just something that I'd have to put 100 hours into to make it good and I haven't had the motivation.

• Thx for the answer Craig! For some reason, I had assumed the "x499" was the multiplication gate, but now I understand how you are counting and I also understand that there is no way of obtaining the binomial distribution with quirk since nested measurements arent viable. Keep up the great work, will definitely start following your blog in the future :) Commented Jul 13, 2019 at 17:28