Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: (Golf) LED Sign

by petral (Curate)
on Jun 10, 2001 at 05:49 UTC ( #87252=note: print w/ replies, xml ) Need Help??


in reply to (Golf) LED Sign

179 chars:

sub led{ ($b=pop)=~y/0-9.\-\0-~/\0-\cK/d; join$/, map{join$", ($"x4,'X ',' X','X X','X'x4)[(/./g)[unpack'C*',$b]] }424434444400, (322231123300)x2, 324444424404, (321222323200)x2, (424x4)-4,"" } print led @ARGV ? shift : "19QQ86\t-- \@0134.72x-0(?)";
(Using hex conversion for the string (and to delete unwanted characters! ) and an array slice of an array slice to generate the lines.)

(Change the trailing ' ~ ' to a ' '(" ÿaut "?) to reject 8-bit chars too -- I wasn't sure how it would travel inside code tags.)

update:  or 172 chars w/o argument checking and putting the '-' first:
($b=pop)=~y/-0-9./\0-\cK/;join$/, map{join$",('X ',$"x4,' X','X X','X'x4)[(/./g)[unpack'C*',$b]]} 142443444441,(132223002331)x2,432444442441,(132022232321)x2,1 .424x4 ,""
  p


Comment on Re: (Golf) LED Sign
Select or Download Code
Re^2: (Golf) LED Sign
by tadman (Prior) on Jun 11, 2001 at 05:02 UTC
    The conversion to low-ASCII for index uses was something that I had considered while writing my first take. I would've used ord instead of unpack. However, using unpack to double as both ord and split is truly devious.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87252]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-04-20 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (486 votes), past polls