Created
September 6, 2020 03:58
-
-
Save fomightez/abf786fa3a21273bf8d722cf898a25ff to your computer and use it in GitHub Desktop.
demo input() using code from https://github.com/decodoku/A_Game_to_Benchmark_Quantum_Computers/blob/62e2b7ca44df607d455e3f6ae31a7addb4f47a3b/QuantumAwesomeness.py#L1481
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.display import clear_output | |
clear_output() | |
print("") | |
print("") | |
print(" __ _ _ __ __ _ ____ _ _ _ _ ") | |
print(" / \\ / )( \\ / _\\ ( ( \\(_ _)/ )( \\( \\/ ) ") | |
print(" ( O )) \\/ (/ \\/ / )( ) \\/ (/ \\/ \\ ") | |
print(" \\__\\)\\____/\\_/\\_/\\_)__) (__) \\____/\\_)(_/ ") | |
print(" __ _ _ ____ ____ __ _ _ ____ __ _ ____ ____ ____ ") | |
print(" / _\\ / )( \\( __)/ ___) / \\ ( \\/ )( __)( ( \\( __)/ ___)/ ___)") | |
print("/ \\\\ /\\ / ) _) \\___ \\( O )/ \\/ \\ ) _) / / ) _) \\___ \\\\___ \\") | |
print("\\_/\\_/(_/\\_)(____)(____/ \\__/ \\_)(_/(____)\\_)__)(____)(____/(____/") | |
print("") | |
print(" A GAME TO BENCHMARK QUANTUM COMPUTERS") | |
print(" by James R. Wootton") | |
print(" University of Basel/Decodoku") | |
print("") | |
print("") | |
input("> Press Enter to continue...\n") | |
intro = str.upper(input("\n> Do you want to read the introduction? (y/n)...\n")) | |
if intro!="N": | |
input("> There are lots of quantum processors around these days. But how good are they really?...\n") | |
input("> How do they compare to each other, and how do they compare to normal computers?...\n") | |
input("> To find out, we can run a simple program on them and see what happens...\n") | |
input("> So that's what we've done. We made a game, and we are running it on all the quantum computers we can...\n") | |
input("> Have a play, and see what you think...\n") | |
input("> You won't learn anything about the mysteries of the quantum world by playing...\n") | |
input("> But you will find out how good current quantum computers are at being computers...\n") | |
input("> The larger and fancier a quantum processor is, the better the puzzles in the game will be...\n") | |
input("> The noisier that a quantum processor is, the more infuriatingly steep the difficulty curve will be...\n") | |
input("> So the quality of the processor is direcly proportional to how much fun you have playing on it...\n") | |
input("> Now choose a device to test out...\n") | |
deviceNotChosen = True | |
attempt = 0 | |
deviceList = "" | |
for device in supportedDevices(): | |
deviceList += device + " " | |
while deviceNotChosen: | |
message = "> The devices you can play on are\n\n " + deviceList + "\n\n> Type the one you'd like below...\n" | |
message = "\n> I'm afraid I didn't understand that.\n"*(attempt>0) + message | |
device = input(message) | |
if device in supportedDevices(): | |
deviceNotChosen = False | |
else: | |
attempt += 1 | |
num, area, entangleType, pairs, pos, example, sdk, runs = getLayout( device ) | |
num_active_qubits = len(pos.keys()) | |
tut = str.upper(input("\n> Do you want to read the tutorial? (y/n)...\n")) | |
if tut!="N": | |
printPuzzle(device,example,"M") | |
input("> The game is a series of puzzles, which look something like this...\n") | |
input("> All the coloured circles" + ((num_active_qubits%2)==1)*" (except one)" + " are paired up...\n") | |
input("> Your job is to identify these pairs...\n") | |
input("> You do this by looking at the numbers: Circles should have very similar numbers if they are paired...\n") | |
input("> As you proceed through the game, the two numbers in each pair will get less similar. This will make the puzzles harder...\n") | |
input("> The game is designed to have a nice gentle increase in difficulty...\n") | |
input("> But noise in the quantum processors increases the difficulty much faster...\n") | |
input("> If you want to see how potent noise is, compare a run on the real device with one on a (noiseless) simulator...\n") | |
input("> You can play some games on the simulator to see how things should be...\n") | |
input("> Or you can play using data from the real device...\n") | |
s = str.upper(input("> Do you want to play a game using data from the real device? (y/n)...\n")) | |
sim = (s!='Y') | |
if sim: | |
input("> The following game data will be from a simulated run...\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment