From: Joey Date: 2006-07-16T03:06:54+09:00 Subject: Re: Who likes Sudoku? ------=_Part_50104_4245994.1152986811461 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Sorry, mine doesnt work. would you mind giving us an input and an output to test with? j`ey http://www.eachmapinject.com http://www.eachmapinject.com/treasure_chest On 7/15/06, Joey wrote: > > Again: > > $p=$*[0].split //;def s;h={};(a=0..80).map{|j|next if > > $p[j]!=0;a.map{|k|h[k/9==j/9||k%9==j%9||k/27==j/27&&k%9/3==j%9/3?$p[k]:0]=1}; > 1.upto(9){|v|next if h.has_key?(v);$p[j]=v;s}end > > j`ey > http://www.eachmapinject.com > > On 7/15/06, studlee2@gmail.com wrote: > > > > Smaller still. Thanks David/Daniel: > > > > $p = ARGV.shift.split(//) > > > > def s > > h=Hash.new() > > 80.times do |j| > > next if $p[j].to_i!=0 > > > > 80.times{|k|h[ > > k.to_i/9==j/9||k.to_i%9==j%9||k.to_i/27==j/27&&k.to_i%9/3==j%9/3?$p[ > k.to_i > > ]:0]=1} > > 1.upto(9){|v|next if h.has_key?(v.to_s);$p[j]=v.to_s;s} > > return $p[j]=0; > > end > > return (puts "\nSolution:#{$p}") > > end > > > > s > > > > > > > > ------=_Part_50104_4245994.1152986811461--