|
Got some code which would take a Perl grand master to understand without running it?
Put it here so we can stare at it in awe.
Word of warning, though:
Don't be too cocky with your post — almost inevitably someone will post a reply that does the exact same thing in even fewer characters!
|
New Less than Readable Code
|
JAPH again
on Nov 11, 2009 at 09:18
|
0 direct replies
|
by mtve
|
|
|
#!perl -l
print map chr oct oct oct oct hex,debf,fbbcf,hex hex eaff,adfff;
print map chr oct oct oct oct oct hex,abadf,hex cd,hex ec,ffaef;
print map chr oct oct oct hex,hex hex oct hex bfd,dbbf,fbbbd,ea;
Update: finally, more fun
print chr oct oct oct hex for qw acfed ccf debf cdefa
|
[Offer your reply]
|
first cut at JAPHs
on Oct 24, 2009 at 16:17
|
0 direct replies
|
by jakobi
|
|
|
perl -MPOSIX -e 'sub _{($.,$/)=@_;eval"\$\\.=sprintf\"\%s\",\"".(grep{s/\S/do{(ord($&)<42+4*2**0.42)?chr((42\/3+1)<<3):$&}/ge,42}grep{s%(?!$)%do{$//=2;"\\\/".(($/=~s/\.\S*//)?ceil sqrt 42:int sqrt 42)}%ge,42}sprintf("%x",$.))[0]." \""};@_=(42292,14,32458834,72,58668,5,8469330,32);while(@_){_@_;@_=@_[2..$#_]};print'|tr UNIX~ REWOP|cat -vet
The vet's first diagnosis: The poor kitten seems to be erudite, but it should probably try a diet of less theory, and instead actively some play rounds of golf. Cautious use of source filtering may also provide support in refactoring into a lean beast. @_@
|
[Offer your reply]
|
Format quine (slightly obfu)
on Oct 15, 2009 at 18:01
|
0 direct replies
|
by bv
|
|
|
Couldn't figure out how to get the #! to work, but it's not really necessary. Uses the open 0 trick, so save it to a file before running
use strict ;my@f; use warnings ;
open 0;$/= \11;my $i= 0; while (
<0>){chop; push@{$f [ $i]},$_;$i
=($i+1)%3} close 0;$~ ="it"; my(
$l,$m,$r)= map{$f[$_] }(0 .. 2);
for(0..$#{ $l}){$m->[ $_]||= '';
$r-> [$_ ] ||=''; #$l }){ $m ->[
format it=
@<<<<<<<<< @<<<<<<<<< @<<<<<<<<<
$l-> [$_], $m-> [$_], $r-> [$_],
.
write;}
print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))
|
[Offer your reply]
|
Fibonacci numbers using regexes (threes are wild)
on Oct 15, 2009 at 12:18
|
0 direct replies
|
by blokhead
|
|
|
perl -le'$;=3;$;=~s/./$&?30:3/eg for 3..pop;print length$;' 12
Replace command-line argument 12 with any positive integer N to get the Nth Fibonacci number. Starts getting pretty slow for me after N=30, by the nature of the algorithm.
Can you see how it works?
|
[Offer your reply]
|
JAPH with only goto (and some noise)
on Oct 09, 2009 at 04:41
|
1 direct reply
|
by haoess
|
|
|
perl -we 'goto qq.\010.x0x11.qq.Just another Perl hacker,\n.'
-- Frank
|
[Offer your reply]
|
map based JAPH
on Oct 08, 2009 at 13:02
|
0 direct replies
|
by vitoco
|
|
|
print(map{chr}(map{$/=$_+$_[$;-!$_];$;=$_?++$;:$_*($/=32);
$/-32*!($.++%13)}map{-46+ord}split//,q,0B>7.';:71!&.62=/.,
),@_[$~..5],44)if$;=$.=$~=0or@_=map{ord}split//,q;hackerz;
|
[Offer your reply]
|
Simple signature
on Sep 21, 2009 at 15:52
|
0 direct replies
|
by markkawika
|
|
|
This is my first attempt at obfuscated Perl. It really rubbed me the wrong way to write it, since I'm such a stickler for maintaintable, readable code. I currently use this as my .signature.
perl -le '$"=$,,@_=(1)x4,@a=(0,4,5,4),map{$_<<=6,$_+=13}@_;for(0..
3){$_[$_]+=1<<$a[$_]if$_;$_[$_]+=$a[$_]}$_[3]+=10,print map chr,@_'
I worked pretty hard on getting it as short and obfuscated as possible. There's a neat trick I used in there with the @a array. It happened to work out mathematically in my favor.
I welcome feedback and/or improvements. :)
|
[Offer your reply]
|
Obfu challenge! What is it?
on Sep 17, 2009 at 21:03
|
0 direct replies
|
by corenth
|
|
|
UPDATE 9/21/2009
Wow. this is a real reminder of how easy it is to fall prey to your own certainty.
I tested my script on a couple of cases, and they turned out fine, so I assumed that all was well.
I tried a new case and found that "something" was wrong. I fixed that something
and was happy. I never bothered to test any other cases until later. OOPS!
I have been running several cases after making my final adjustments. I believe that NOW the script solves all
problems it's designed too. I AM crossing my fingers on this, but it looks like I've repaired all my bits.
(pun absolutely intended- also a hint)
Well, not quite. There is one case that it does solve, & I don't know why that is... maybe someday I'll get it. As it is, I'm putting adjusted code in a less obfuscated manner bacause I'm a tad too lazy to worry about it...
Big UPDATE: I left out a key peice of code in the obfuscation. The output was incorrect for the lack of that code. Now that it's in there, all problems of the sort that this code solves should be solved unless I hade any other errors in logic *sigh* Of course, if you have the non-corrected code, you might gain some insight from comparing the two versions.
I have three some challenges with this obfuscated code:
1. Can you figure out the purpose of this code?
2. What ways can the code be obfuscated further? I've never done this before, and haven't quite gotten the hang of it.
3. What metaphors do you think I've used? I use the term to refer to things like how I might visualise the data (tables, lists, objects) or how I perceive the problem (is it recursive, is A the function of B, is "brute force" used to solve a problem, or perhaps a genetic algorithm).
4. Better code? Keeping the metaphors you think I'm using, how can I optimize it to run faster?
5. Why is there a leading white space in the output- must be in there somewhere.. I've no idea..
Hints:
There are some optimizations that I have not used in order to keep with one "metaphor" that I'm using.
The problem I'm solving has been golfed before. This is DEFINITELY not a golf! I don't know about obfuscations.
The output needs to be formatted to make it recognizable to someone who knows this kind of problem. Also, while the problem's solved, the output values are not what's expected of solutions to this type of problem.. Update: Perhaps I should say that the output itself is slightly obfuscated. Correct output would by way too obvious.
As I said before " it looks like I've repaired all my bits" - pun and hint all in one!
I really don't know if this is going to be an easy task or an impossible one. If it's too difficult I will have to add hints. If I had to solve a puzzle like this, I'm not sure that I could.
Update: perl -v gives This is perl, v5.8.3 built for ppc-linux-thread-multi on my system. I doubt this will be an issue for anyone else.
Good Luck!
|
[Offer your reply]
|
Linux console japh
on Sep 05, 2009 at 08:41
|
2 direct replies
|
by ambrus
|
|
|
Run this on linux text console only. It won't work in an xterm or similar. (Update:) This looks better if you stand far from the monitor.
clear;perl -we 'ioctl STDIN,19296,$t=pack a8888;while(++$o){select"","
+","",0.01;print"\e[H";for$v(0..19){$x=0.5*$_+3e-2*$v*($_-39)+0.5*$o,p
+rint vec($t,8-$x%9+8*int(0.9*$v+1.5-3e-3*($_-39)**2)+256*ord substr("
+Just another Perl hacker ",$x/9%26),1)?"#":" "for 0..78;print$/}}'
This is a reimplementation of a japh I have written and lost long ago. Speed depends on the speed of your computer somewhat.
|
[Offer your reply]
|
Perl 6 bitwise
on Aug 24, 2009 at 21:18
|
1 direct reply
|
by carlin
|
|
|
Just something I threw together together while playing with Perl 6's bitwise operators. Haven't really tried to golf it and the obfuscation is fairly obvious. Runs fine under Rakudo, haven't tested any other implementation.
my $s=' ';say 'N'~&'K','t'~|'a','w'~&'s','v'~&'u',$s,'i'~&'e','l'~|'b'
+,'m'~|'b','p'~|'d','x'~&'i','g'~&'m'~'z'~&'s',$s,'c'~&'v','o'~&'y','p
+'~|'d','v'~|'a','m'~&'y','r'~|'a','d'~|'a',$s,'n'~|'a','c'~&'z','d'~|
+'b','t'~|'a','r'~|'a','b'~|'a','i'~&'c','v'~&'u','k'~&'y','n'~|'a','l
+'~|'b';
Tip: ~| is | in Perl 5 and ~& is & in Perl 5.
|
[Offer your reply]
|
|
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|