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

Evil JAPH

by etcshadow (Priest)
on Mar 22, 2004 at 05:58 UTC ( [id://338565] : obfuscated . print w/replies, xml ) Need Help??

Far more than just a JAPH, but can you see what it is? (This is a challenge to you all... spoilers properly hidden, please).
#!/usr/bin/perl ($c=>$i)=(shift()=>shift);@i=split//=>$i; $n=<<'for(;@s;$s^=pop@s){}';$c||=$n;eval$n;print"\n";die; $c=~s/[^\+\-\054\056<>[\]]//sg;@p=split//=>$c;sub b(\@@){\shift->[shift]}for(@p){/\[/&&push@s=>$s; /]/&&(${b@e=>pop@s}=$s);$s++}@s||0>1&&die; for(;$_=${b@p=>$p};$p++){/\074/&&$d--; /\054/&&(${b@d=>$d}=ord(shift@i));/\+/&&-${b@d=>$d}++; /\x5b/&&(${b@d=>$d}?(push@s=>$p):($p=${b@e=>$p})); /\-/&&${b@d=>$d}--;/\056/&&print(chr(${b@d=>$d})); /\x5d/&&(${b@d=>$d}?$p=${b@s=>$#s}:pop@s);/\>/&&$d++;} $e+=++$s[(3>$p?++$p>0:++$d+$p++||+1<<0-1)&&0]>>$e++; $p[(${b@p=>$p+push@s=>$p++}>$e++?$s+1>++$d:++$b)&0<<2<<-0]; $p>>=$d++|+$i++&0;pop@s;$s++;$e++;@s=split+/./=>$c; for(;$e>0;$e--){--$e;$s-=1;$n="------".$s--."+".(1<<$e<2). "\n";}$c>>=1;$c+=3.141592654;${b@s=>--$s}--;$n=$s--.(1+$s). "+++++".$e;$d<++$s?++$c:++$i;@e=split+/./;--$e{$s}&&exit;/-/&& ($s.="$c/$e");print$s>--$i;$.<<=$<;@p=split/.(?>-)/; ($s>$e||$s>$c)&&$s--;$c.=q<.>;print$p++."\n"; print(chr(ord shift(@i)-1));$s<$e&&push@s=>--$i; /\x64/&&--$e;print-0||"$^O".$s[$s<0?$e:$s];for(;$e>0;$_.=$e){ $p>>=($d++)+1;$_.=$c;tr|a-z0-9A-Z|A-Za-ka-z|} <>;@d=sort{$a-$b<=>0}split/.+/;$e+=.1;push@s=>$e; /-/&&($_.=q<ff^aa+ab+ac.ad^ff>);s+(\w\+)+$1\+$s\+\++sge; print"\n".$s[$s<0?$e:$s];<.>;print${b@e=>$p}; for(;@s;$s^=pop@s){} print$s;
------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re: Evil JAPH
by teamster_jr (Curate) on Mar 22, 2004 at 10:53 UTC
    Dude, that totally rocks!
    I'm fairly sure i know what it does:
    Spoiler below:
    It's a brainf*ck parser yeah?
    with the japh written in bf encoded into the code of the interpretter: this line: $c=~s/[^\+\-\054\056<>[\]]//sg; removes all the non bf chars ($c is by default the parser code) so you can cat in a bf string and whatever arguments you need...
    Very nicely done. ++ etc
    Alex

    Update: Worked out how to use it (ish) and clarified my spoiler.