From: Sea&Gull Date: 2005-01-10T02:21:23+09:00 Subject: Re: [SOLUTION] LCD Numbers (#14) Cool! :o) It's only slightly hard to read, but informational saturation/elegance of each string impresses... ;-) -- s&g Jannis Harder wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Here is my solution ( 398 bytes ) > And my solution with hex digits ( 405 bytes) > > Usage: > 14-1.rb number* [-s size] number* > Right: > 14-1.rb -s 9 456456 > 14-1.rb 456456 -s 9 > 14-1.rb 4 5 64 56 -s 9 45 6456 > Wrong: > 14-1.rb -s9 456456 > > > ### Dec > s=$*.index("-s");s=(s ?$*.slice!(s,2)[1].to_i: 2) > i=$*.join.split("").map{|x|x.to_i} > d,="7krtt1r30v/s".unpack("m")[0].unpack("B*") > f=" " > a,b=f*s,f+"-"*s+f > c,e,o="|",a+f+f,49 > y=([0]*5).map{""} > i.each{|z|u=d[z*7,7] > y[0]<<(u[0] y[1]<<(u[1] y[2]<<(u[3] y[3]<<(u[4] y[4]<<(u[6] y.map!{|v|v<<32}} > y[1,1]*=s > y[2+s,1]*=s > puts y > ### > > ### Hex > s=$*.index("-s");s=(s ?$*.slice!(s,2)[1].to_i: 2) > i=$*.join.split("").map{|x|x.hex} > d,="7krtt1r30v/v8vyn9uw=".unpack("m")[0].unpack("B*") > f=" " > a,b=f*s,f+"-"*s+f > c,e,o="|",a+f+f,49 > y=([0]*5).map{""} > i.each{|z|u=d[z*7,7] > y[0]<<(u[0] y[1]<<(u[1] y[2]<<(u[3] y[3]<<(u[4] y[4]<<(u[6] y.map!{|v|v<<32}} > y[1,1]*=s > y[2+s,1]*=s > puts y > ### > > PS: it took me 7 minutes to write this mail because everytime I pasted > the source I found another way to do it in less bytes > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.2.6 (Darwin) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFB4WPd5YRWfc27RzQRAmyXAJ9lEcHjbKdIGDLKZAorKDbp/W6u3QCgo2uC > zsgHcCAhm7jkLJpJultYnBI= > =Gk50 > -----END PGP SIGNATURE----- > >