Skip to content

Instantly share code, notes, and snippets.

@jeek
Created March 21, 2012 15:14
Show Gist options
  • Save jeek/2148250 to your computer and use it in GitHub Desktop.
Save jeek/2148250 to your computer and use it in GitHub Desktop.
def checkdist(a,b,c,d,e,f,g):
array = sorted([abs(0-a),abs(1-b),abs(2-c),abs(3-d),abs(4-e),abs(5-f),abs(6-g)])
i = 0
goodanswer = 1
while (i + 1 < len(array)):
if (array[i] == array[i + 1]):
goodanswer = 0
i += 1
if (goodanswer == 1):
print a,b,c,d,e,f,g,array,"GOOD"
else:
print a,b,c,d,e,f,g,array,"BAD"
for a in range(7):
for b in range(7):
if (a != b):
for c in range(7):
if (a != c and b != c):
for d in range(7):
if (a != d and b != d and c != d):
for e in range(7):
if (a != e and b != e and c != e and d != e):
for f in range(7):
if (a != f and b != f and c != f and d != f and e != f):
for g in range(7):
if (a != g and b != g and c != g and d != g and e != g and f != g):
checkdist(a,b,c,d,e,f,g)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment