-
-
Save sammko/94d41c83ef110d197074f39b3e84f96c to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/python | |
import os, random, sys | |
CMD = 'mpv --really-quiet --vid=no "{}"' | |
if len(sys.argv) != 3: | |
print(f"Usage {sys.argv[0]} FILE_A FILE_B") | |
sys.exit(1) | |
fa, fb = sys.argv[1:3] | |
G = { | |
'a': fa, | |
'b': fb | |
} | |
total = 0 | |
right = 0 | |
while True: | |
i = input("abX> ").strip().lower() | |
if i == 'q': | |
break | |
if not i: | |
i = 'x' | |
elif i not in 'abx': | |
continue | |
guess = False | |
if i == 'x': | |
guess = True | |
i = random.choice('ab') | |
print("Playing...") | |
os.system(CMD.format(G[i])) | |
if guess: | |
j = input(" ab? ").strip().lower() | |
if j == '?': | |
print("Skipping") | |
continue | |
total += 1 | |
if j == i: | |
right += 1 | |
print("Correct") | |
else: | |
print("Wrong") | |
print(" -- {:.2f}% [{}/{}]".format( | |
100*right/total, | |
right, | |
total | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment