Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^4: Golf: Seven segment display

by mtve (Deacon)
on Jan 27, 2012 at 13:52 UTC ( [id://950370]=note: print w/replies, xml ) Need Help??

in reply to Re^3: Golf: Seven segment display
in thread Golf: Seven segment display

a few obvious optimizations:

say map$'&2**$_?$_>9?'|':_:$",map{2 .$_,$_,1 .$_}split!//,"@_"for 1005,924745596,341831533

Replies are listed 'Best First'.
Re^5: Golf: Seven segment display
by kikuchiyo (Hermit) on Jan 28, 2012 at 18:08 UTC

    I'd say the use of $' is less than obvious. Nice work btw.

    The shortest solution I know (not my own creation):

    for$;(0..2){say map{substr' | |_|_ _ _|',vec('0123456789abcdef',$;.$ +_,4),3}"@_"=~/./g}

    where '0123456789abcdef' is to be substituted with "\x09\x99\x90\x99\x99\x13\xBB\x75\x17\x55\x15\xB7\xB1\x15\xB5". When the \x codes are replaced with the actual characters, it comes out two characters shorter than the solution above. (Not very elegant, though.)


      Could be shortened by two chars using the same tricks:

      say map{substr'   | |_|_ _ _|',vec('0123456789abcdef',$'.$_,4),3}split!//,"@_"for 0..2

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-05-23 16:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found