Skip to content

Instantly share code, notes, and snippets.

@danya02
Last active September 18, 2016 13:16
Show Gist options
  • Save danya02/bd79f89bbe842495df1a1a1822ce6403 to your computer and use it in GitHub Desktop.
Save danya02/bd79f89bbe842495df1a1a1822ce6403 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import random
magic = { # some automagical codes
"start_line": "\r",
"clear_line": "\033[K"}
matrixa_init=[]
matrixb_init=[]
for i in range(1,18):
matrixa_init+=[i]
matrixb_init+=[i]
max=0
iter=0
while 1:
iter+=1
matrixa=matrixa_init.copy()
matrixb=matrixb_init.copy()
random.shuffle(matrixa)
random.shuffle(matrixb)
fail=0
for m,f in zip(matrixa,matrixb):
matrixa.remove(m)
matrixb.remove(f)
if not m<=f:
fail+=1
if fail>max:
max=fail
print(magic["clear_line"]+"LASTFAIL: "+str(max)+"(EPOCH "+str(iter)+")"+magic["start_line"], end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment