From 79dc2cafb5aef81fbf58f28ebc7d0ab33ce654ed Mon Sep 17 00:00:00 2001 From: roosado Date: Thu, 7 Jan 2021 12:04:31 -0600 Subject: [PATCH] Flips the result measurement display When ran, Bob's received message was printing flipped (i.e. it printed "01" when it received "10"). The issue wasn't in the measurement, because when printing "res.measurements" it correctly assigned the values to the qubits from the message as expected. This correction flips the bitstring display so it prints the message correctly. The error might come from a change in how cirq saves measurements from simulators, but I'm not sure. --- chapter07/cirq/superdense-coding-cirq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter07/cirq/superdense-coding-cirq.py b/chapter07/cirq/superdense-coding-cirq.py index 7dc2f0d..e4c8f0f 100644 --- a/chapter07/cirq/superdense-coding-cirq.py +++ b/chapter07/cirq/superdense-coding-cirq.py @@ -42,4 +42,4 @@ def bitstring(bits): res = sim.run(circ, repetitions=1) # Print out Bob's received message: the outcome of the circuit -print("\nBob's received message =", bitstring(res.measurements.values())) +print("\nBob's received message =", bitstring(res.measurements.values())[::-1])