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/
|
---|
In Section
Meditations