smart sudoku golf


the indicate doubt emanate shortest not abusively slow sudoku solver. tangible as: don't recurse there spots house wholly presumably digit.



here shortest i have distant python:



r=range(81)
s=range(1,10)
def r(a):
bzt={}
i r:
a[i]!=0: continue;
h={}
j r:
h[a[j]if(j/9==i/9 j%9==i%9 or(j/27==i/27)and((j%9/3)==(i%9/3)))else 0]=1
bzt[9-len(h)]=h,i
l,(h,i)in sorted(bzt.items(),key=lambda x:x[0]):
j s:
j h:
a[i]=j
r(a):return 1
a[i]=0;return 0
imitation a;return 1

r(map(int, "080007095010020000309581000500000300400000006006000007000762409000050020820400060"))


the final line i take biased cmd line input, altered to:



import sys; r(map(int, sys.argv[1]);


this identical sudoku golf challenges, solely i wish discharge low recursion. any libel acceptable. plea on!



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?