Last active
December 10, 2015 09:39
-
-
Save arikrak/4415721 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
#Andy's final solution to Sudoku CodeGolf | |
r=range | |
t=r(9) | |
a=r(81) | |
def s(x): | |
if x<0:return 1 | |
while(x | |
and | |
n[x]):x-=1 | |
for l in t: | |
n[x]=l+1 | |
if 0==any(i/9==j/9 | |
or | |
i%9==j%9 | |
or | |
i/27==j/27 | |
and | |
i%9/3==j%9/3 | |
for | |
i | |
in | |
a | |
for | |
j | |
in | |
r(i)if | |
n[i]and | |
n[i]==n[j])and s(x-1):return 1 | |
n[x]=0 | |
n=[int(x)for i in range(9) for x in raw_input() if x > ' '] | |
s(80) | |
for i in a:print n[i],chr(32-i%9/8*22), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment