Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Code Golf: Four is magic

by thundergnat (Deacon)
on Jul 14, 2010 at 16:53 UTC ( #849566=note: print w/ replies, xml ) Need Help??


in reply to Code Golf: Four is magic

Update: 122 Just realized that there is no requirement to output to STDOUT, so output to STDERR instead and knock off another character.

#234567890123456789012345678901234567890123456789012345678901234567890 +1234567890123456789012345678901234567890123456789012 @u="0335443554366887798866555766"=~/./g;$_+=<>;warn"$_ is ",$_=$_-4?$_ +<20?$u[$_]||4:$u[chop]+$u[$_+18]:magic,".\n"until/a/

Update: 123

#234567890123456789012345678901234567890123456789012345678901234567890 +12345678901234567890123456789012345678901234567890123 @u='0335443554366887798866555766'=~/./g;$_+=<>;print"$_ is ",$_=$_-4?$ +_<20?$u[$_]||4:$u[chop]+$u[$_+18]:magic,".\n"until/a/

121 124 strokes

Update 2 Whoops. Broken for zero. Add three strokes.

# 12345678901234567890123456789012345678901234567890123456789012345 +67890123456789012345678901234567890123456789012345678901234 perl -E'@u="0335443554366887798866555766"=~/./g;$_+=<>;say"$_ is ",$_= +$_-4?$_<20?$u[$_]||4:$u[chop]+$u[18+$_]:magic,"."while/\d/'

or alternately, also 124 strokes:

#234567890123456789012345678901234567890123456789012345678901234567890 +123456789012345678901234567890123456789012345678901234 @u='0335443554366887798866555766'=~/./g;$_=pop;print"$_ is ",$_=$_-4?$ +_<20?$u[$_]||4:$u[chop]+$u[$_+18]:magic,".\n"until/\D/

Updated: Argh. posted wrong (broken) version. Try again.

# 12345678901234567890123456789012345678901234567890123456789012345 +67890123456789012345678901234567890123456789012345678901 perl -E'@u="0335443554366887798866555766"=~/./g;$_+=<>;say"$_ is ",$_= +$_-4?$_<20?$u[$_]:$u[chop]+$u[18+$_]:magic,"."while/\d/'

or alternately, also 121 strokes:

#234567890123456789012345678901234567890123456789012345678901234567890 +123456789012345678901234567890123456789012345678901 @u='0335443554366887798866555766'=~/./g;$_=pop;print"$_ is ",$_=$_-4?$ +_<20?$u[$_]:$u[chop]+$u[$_+18]:magic,".\n"until/\D/


Comment on Re: Code Golf: Four is magic
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-07-08 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls