I was at the club tonight when i saw a manifest for a new year party. So the quest materialized in my mind: printing "2002" without using numbers. Everything else is allowed. A special premium goes to the one who Golf it. Special mention to the most OBFU one. Here two samples (it's 4:29 in the morning, so i don't have anything better): print $^F.$|.$[.$^F; #the simpler way
#a more mathematical approach
print $^F**(++$_.$_)-$=+$^F**$^F**$^F-$^F;
Happy new year ;)
gkinueliileunikg
Re: TMTOWTDI the new year!
by wog (Curate) on Dec 23, 2001 at 09:03 UTC
|
# ASCII specific
print"SQQS"^"aaaa"
#23456789012345678
# 1
update: If we don't care about
strict we can do:
print+SQQS^aaaa
#23456789012345
# 1
Not golfing:
use LWP::Simple;
print get("http://perlmonks.org/?node=TMTOWTDI+the+new+year!")
=~ /printing "(\d+)"/;
# or
print y/a// for qw(aa bb bb aa);
# or
update: Oops. I didn't type kill in here orginally:
print kill($$-$$,@$_) for [$$,$$], [], [], [$$,$$];
# or
use Fcntl qw(:seek);
print SEEK_END, SEEK_SET, SEEK_SET, SEEK_END;
# or
$_ = "weirdness";
print y ueuu, y fuff, y sfss, y esee;
| [reply] [d/l] [select] |
Re: TMTOWTDI the new year!
by japh (Friar) on Dec 23, 2001 at 15:14 UTC
|
my first publicly-posted perl obfuscation.
#!/usr/bin/perl -l
print
bulldozer_(" _ _ | two
_ __ ___ _ __| |_ __ ___ ___ _ __ | | _____ |
| '_ \ / _ \ '__| | '_ ` _ \ / _ \| '_ \| |/ / __| | thousand
| |_) | __/ | | | | | | | | (_) | | | | <\__ \ |
| .__/ \___|_| |_|_| |_| |_|\___/|_| |_|_|\_\___/ | two
|_|
") ;sub#marine)
bulldozer_{ #"=.
$_ = length shift;
$_
--+$_
--+$_
--+$_
--+$_
--+$_
--+$_ }#_bulldozer
Update: spoiler
A string (the 2002 banner) constructed with figlet and vi is passed to a function named bulldozer_, which takes the length of it and repeatedly adds that number to itself while decrementing it by 1 each time. The result of this construct is passed back to the original print statement.
| [reply] [d/l] |
Re (tilly) 1: TMTOWTDI the new year!
by tilly (Archbishop) on Dec 23, 2001 at 12:27 UTC
|
$==$';$;||$.|$|;$_='*$(^@(%_+&);@-);~~,.*+,./|);;;~~@-;#~~;#@-;#@-;#~~
+@-__&$#%^';$__='`'&'&';$___="````"|"$[`$["|'`%",';$~=("$___$__-$[``$_
+_"|"$___"|("$___$__-$[.%")).("'`"|"'$["|"'#").'/.*?&([^&]*)&.*/$'.++$
+=.("/``"|"/$[`"|"/#'").(";`/[\\`\\`$__]//`;"|";$[/[\\$[\\`$__]//`;"|"
+;#/[\\\$\\.$__]//'").'@:=("@-","/.","~~",";#",";;",";.",",.",");","()
+","*+","__","-(","/@",".%","/|",";_");@:{@:}=$%..$#:;'.('`'|"$["|'#')
+."/(..)(..)/".("```"|"``$["|'#("').'(($:{$'.$=.'}<<'.(++$=+$=).')|($:
+{$'.$=.'}))/'.("```;"|"``$[;"|"%'#;").("````'$__"|"%$[``"|"%&!,").${$
+[};`$~$__>&$=`;
UPDATE
I should puncuate this with the somewhat symmetrical:
print --$|+$|.$?.$?,$?.$?.$|+$|--
| [reply] [d/l] [select] |
|
Did someone say symmetrical?
print !$!+!$!.$$*-$-.-$-*$$.!$!+!$!
andy. | [reply] [d/l] |
Re: TMTOWTDI the new year!
by Albannach (Monsignor) on Dec 23, 2001 at 10:14 UTC
|
# 1 2
#2345678901234567890
print"$^F$[$[$^F"
Of course die would be cheaper but I'll assume we ONLY want "2002" ;-)
Geesh, how unoriginal! I should really read the entire root node
before posting the first thing that comes to mind!
Silly, and for a limited time only:
@foo = split' ',scalar localtime;
$bar = pop @foo;
print ++$bar;
--
I'd like to be able to assign to an luser | [reply] [d/l] [select] |
Re: TMTOWTDI the new year!
by giulienk (Curate) on Dec 23, 2001 at 20:19 UTC
|
With a fresh mind (and some luck) I got this new cool one:$;+=ord for(split'','MerryXMAS&&HappyNEWYEAR!');print$;
Update: the following looks betterprint eval join'+',map{ord}split'','MerryXMAS&&HappyNEWYEAR!'
gkinueliileunikg | [reply] [d/l] [select] |
|
Very nice! Maybe put the greeting first?:
$_= "MerryXMAS&&HappyNEWYEAR!"; s/./"+".ord$&/ge; print eval,$/
  p | [reply] [d/l] |
Re: TMTOWTDI the new year!
by gmax (Abbot) on Dec 31, 2001 at 18:48 UTC
|
I hope it isn't too late for my contribution.
Nothing special. Just to wish you all a pleasant new year.
perl -e '$_=sprintf("%d",pack "H*",b).unpack "H*",b;m/\d$/;$b=$&;m/^\d
+/;print "$b$&$&$b$/"'
perl -e '$a=unpack("H*",d)-unpack "H*",b;$b=sprintf"%d",pack"H*",b;pri
+nt "$a$b$b$a$/"'
perl -e '$b=$a=ord(b)-ord(a);print++$a,--$b,$b,$a,$/'
perl -e '$a=@{[a,b]};$b=@{[]}; print "$a$b$b$a$/"'
perl -e '($a=$%)++;print ++$a,$%,$%,$a,$/'
Cheers
_ _ _ _
(_|| | |(_|><
_|
| [reply] [d/l] [select] |
Re: TMTOWTDI the new year!
by Juerd (Abbot) on Dec 23, 2001 at 18:21 UTC
|
"Happy new year" in many languages :)
Note: This is a double obfuscation, as eval() doesn't get any number too (hint: s/eval/print/...
This script needs support for named characters in Perl.
#!/usr/bin/perl -l
eval join "", map { chomp && chr length } <DATA>
| [reply] [d/l] [select] |
Re: TMTOWTDI the new year!
by mrbbking (Hermit) on Dec 23, 2001 at 21:23 UTC
|
Leaving golf and obfuscation to those more suited to the task, I'll go for simplicity...
print length(' '),length('');
print length(''),length(' ');
| [reply] [d/l] |
Re: TMTOWTDI the new year!
by andye (Curate) on Dec 23, 2001 at 22:18 UTC
|
print tr/w//<<!$, for qw(two thousand and two)
andy. | [reply] [d/l] |
Re: TMTOWTDI the new year!
by japh (Friar) on Dec 31, 2001 at 13:36 UTC
|
I bred these critters (composed of 4 flavors of gene) overnight using a modified version of gumpu's code at Genetic Programming or breeding Perls. They're 24 genes long because I was going to obfuscate a map of them in a string the same length as "Just Another Perl Hacker" but the new year is almost upon us :)
perl -le '$_+=$_++;$_+=--$_;$_+=$_--;$_+=++$_;$_+=$_++;$_+=$_--;$_+=$_
+--;$_+=--$_;$_+=$_--;$_+=$_++;$_+=++$_;$_+=++$_;$_+=--$_;$_+=$_--;$_+
+=--$_;$_+=$_++;$_+=$_--;$_+=--$_;$_+=$_--;$_+=$_--;$_+=$_++;$_+=--$_;
+$_+=++$_;$_+=--$_;print'
perl -le '$_+=$_--;$_+=$_++;$_+=++$_;$_+=$_++;$_+=$_--;$_+=--$_;$_+=$_
+--;$_+=$_++;$_+=$_++;$_+=++$_;$_+=$_++;$_+=--$_;$_+=++$_;$_+=--$_;$_+
+=$_--;$_+=++$_;$_+=$_--;$_+=$_++;$_+=$_--;$_+=++$_;$_+=++$_;$_+=++$_;
+$_+=--$_;$_+=--$_;print'
perl -le '$_+=$_--;$_+=++$_;$_+=$_--;$_+=$_++;$_+=++$_;$_+=$_++;$_+=--
+$_;$_+=$_--;$_+=++$_;$_+=$_--;$_+=++$_;$_+=$_++;$_+=$_--;$_+=$_++;$_+
+=$_--;$_+=--$_;$_+=$_--;$_+=$_++;$_+=$_++;$_+=$_++;$_+=--$_;$_+=--$_;
+$_+=--$_;$_+=--$_;print'
perl -le '$_+=$_--;$_+=++$_;$_+=$_--;$_+=++$_;$_+=$_++;$_+=--$_;$_+=$_
+++;$_+=$_--;$_+=--$_;$_+=$_--;$_+=++$_;$_+=++$_;$_+=--$_;$_+=$_--;$_+
+=$_--;$_+=$_--;$_+=$_--;$_+=--$_;$_+=$_--;$_+=--$_;$_+=++$_;$_+=$_--;
+$_+=++$_;$_+=++$_;print'
The four arbitrary gene types allow for 2002-printing critters of length ten:
perl -le '$_+=++$_;$_+=++$_;$_+=++$_;$_+=++$_;$_+=$_++;$_+=++$_;$_+=++
+$_;$_+=++$_;$_+=--$_;$_+=--$_;print'
| [reply] [d/l] [select] |
Re: TMTOWTDI the new year!
by toma (Vicar) on Dec 24, 2001 at 12:30 UTC
|
Not golf or obfu, but 2002 is an interesting number!
perl -e '$_++;print "$_$_"*ord("\a")*ord("\r")<<$_'
It should work perfectly the first time! - toma | [reply] [d/l] |
Re: TMTOWTDI the new year!
by petral (Curate) on Dec 24, 2001 at 23:22 UTC
|
s|^$|$^|s;
s|.|..|g;
s|.|s///g|ge;
s|..|$&.reverse.$/|e;
print
But it still has a word in it (other than the final print) :(.
  p | [reply] [d/l] |
Re: TMTOWTDI the new year!
by crazyinsomniac (Prior) on Dec 31, 2001 at 14:46 UTC
|
#000000000000001234567
>perl -e"print 4004>>1"
update: d'oh ;) now it does
perl -le"print $^F,$|,(@_=($|.. ~~ map ord~$_,split//,~$^)[$|,$^F])"
perl -le'print $^F,$|,(@_=($|.. ~~ map ord~$_,split//,~$^)[$|,$^F])'
perl -le"print $^F + join'',$^F,$|,($|.. ~~ map ord~$_,split//,~$^)[$|
+,~$0]"
perl -le'print $^F + join"",$^F,$|,($|.. ~~ map ord~$_,split//,~$^)[$|
+,~$0]'
## works sometimes
perl -e"$a.=$_ for unpack 'c*',~$^V;@ARGV=sort(split//,$a);map pop, $^
+F+$^F..$#ARGV;print pop,shift,shift,pop"
update:
and one or two more
perl -le"print $]<<$^F,$[,substr$]<<$^F,-2,1"
perl -le'print $]<<$^F,$[,substr$]<<$^F,-2,1'
perl -le"print $]<<$^F,$^F>>$],$^F>>$|"
perl -le'print $]<<$^F,$^F>>$],$^F>>$|'
| [reply] [d/l] [select] |
|
Your submission is interesting but don't follow the rules given in the root node: no numbers. Anyway happy new year to crazyinsomniac too :)
gkinueliileunikg
| [reply] |
Re: TMTOWTDI the new year!
by Juerd (Abbot) on Mar 06, 2002 at 11:51 UTC
|
Yeah, I know it's a bit late for a 2002-TIMTOWTDI, but I re-read this thread and i sort of got inspired by the critter-like code ($_+=$_-- etc), and created this late entry:
$|++;$_="+++++[>++++++++++>++<<-]>.-
-..++.>.";tr/-+,.[]<>//cd;for$a(qw%]}
[while($p[$p]){ -$p[$p]-- +$p[$p]++
,$p[$p]=ord(getc) .print(chr($p[$p]))
<$p-- >$p++%){s/\Q${\ substr$a,"foo",
$|}/${\substr$a,$|};/g}eval
{grin}
brainf*ck++
++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
- Whreq
| [reply] [d/l] |
|
|