Created
September 5, 2015 09:15
-
-
Save dps/75f3589a9b73a46c57f1 to your computer and use it in GitHub Desktop.
A short Sudoku solver in Scala. By Muntis Grube
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
def s(l:String):Unit={val i=l indexOf '0' | |
if(i<0)println(l)else | |
for{c<-'1'to'9' | |
if(0 to 80).forall(n=>((n-i)%9*(n/9^i/9)*(n/27^i/27|n%9/3^i%9/3)|l(n)^c)!=0)} | |
s(l.replaceFirst("0",""+c))} | |
s(args(0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment