sudoku by yvl

(k=v=m=[$_]
(t=[?3,?5]|[*?1..?9]
9.times{|j|t-=[v[k%10+10*j],v[k/10*10+j],v[h=k/30*30+k%10/3*3+j/3*10+j%3]]}
t.map{|x|q=""+v
q[k]=x
m<<q})while k=/0/=~v=m.pop
$><<v)while gets$/*2

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page