[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Fwd: Another "Golf Game" LCD solution

James Gray

4/5/2007 1:45:00 PM

Begin forwarded message:

> From: David Ongaro <david.ongaro@hamburg.de>
> Date: April 5, 2007 8:38:19 AM CDT
> To: submission@rubyquiz.com
> Subject: Another "Golf Game" LCD solution
>
> Dear Mr. Gray,
>
>> People still work the old quizzes it seems...
>
> But they are still worthwhile, aren't they? Anyway I just reached
> Page 9
> of your Book and couldn't withstand to try to beat David Trans
> record of
> the shortest solution for the LCD Problem. I had a solution of similar
> size, but when I combined ideas from both solutions and made some
> further improvements I was able to get down to 210 Bytes, which
> might be
> a new record.
>
> S=(s=$*.index"-s")?$*.slice!(s,2)[1].to_i: 2
> def b i=1
> [' - ',' ||'][@x&1][i*(1&"w$]m.k{%\177o"[@z.to_i]>>@x/2*3+i-1),1]end
> 5.times{|@x|puts(([S,1][@x&1]..S).map{$*[0].split('').map{|@z|b(2)
> +b*S+b(3)}*' '})}
>
>
> I'm aware that these problems are not supposed to be solved like this,
> but I had fun and learned a lot about ruby this way (I wonder how
> much I
> can learn from your book when I get past Quiz 2..).
>
> Sincerely
>
> David Ongaro
>