------art_54022_30537643.1153037221647
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

There *is* a need for the return, as it breaks execution.

On 7/16/06, Daniel Schierbeck <daniel.schierbeck / gmail.com> wrote:
>
> Adam Shelly wrote:
> > On 7/15/06, Adam Shelly <adam.shelly / gmail.com> wrote:
> >> Yes, before we golf this further, does it even work?
> >
> > oops, my mistake.  I was giving it a filename containing a puzzle on
> > the command line instead of the puzzle itself.  It does run and
> > converge - but it leaves the last digit 0 unless you make the outer
> > loop 81.times.   Here's what I've got - I mapped the input to
> > integers, which removed a bunch of 'to_i's.
> > def s; h
> >  81.times{|j| next if $p[j]>0
> >    80.times {|k| h[$p[k]]   if k/9/9 || k%9%9 || k/27/27
> > && k%9/3%9/3}
> >    1.upto(9){|v| $p[j]and s unless h[v]}
> >    return $p[j] }
>
> There's no need for the `return' keyword, nor for the semicolon.
>
>    $p[j]
>
> >  p "Solution: #{$p}"
> > end;
>
> The semicolon is unnecessary.
>
> > $p  *[0].split('').map{|v|v.to_i}; s
> >
>
>
> Cheers,
> Daniel
>
>

------art_54022_30537643.1153037221647--