Re: I refuse to explain this
by jynx (Priest) on Apr 13, 2001 at 00:43 UTC
|
i'm probably completely off, but it seems to iterate over $_, slowly changing it as it goes along. The two important parts seem to be:
# this increments $R, which tells us which character we're going to pr
+int
|`i($z) (?{$R++,$q=6)
# it tells us that through this snippet:
`p($z)(?{print(chr 120-$R),$R=0,$q=7})
So whenever the substitution matches a `i($z) it'll increment $R, and once that gets incremented enough times the RE will match (at some point before matching `i again) `p($z).
$z seems to just match any number of backticks (and $d is set to 2, although this doesn't need to happen) or any number of characters, and $d is set to zero. $d is important because (if i'm reading this right) when there are only backticks left, $z won't match because of the $d flag. This is what will eventually stop the do{}while loop (i think).
The only thing i'm hazy about (other than the whole thing :-) is %bind. Because of it's use you can't use strict, because i don't see it in the built-ins in camel3. And i'm not sick enough to looptrace far enough to find out what $14 and $17 and whatnot else might actually be to see what it's up to.
On the other hand, since this obfuscation completely breaks the debugger (causing it to drop core on my machine), i can't get more details without trying to a) enter Dominus brain or b) become god. Neither seems really possible at this point.
Kudos and ++, this is a work of art.
jynx
PS feel free to /msg or node me that i'm completely wrong, because i'm guessing i am... | [reply] [Watch: Dir/Any] [d/l] |
|
$z matches 1 more \w than ': eg, >B< or >``Es`KI`B<, etc.
Except for those ```S's, this generally results in a slightly shorter (different) line.
Changing the 'p' handling to:
|`i($z) (?{$R++,$q=6})|`p($z) (?{$X=$R;$R=0;$q=7})
. . .
:($15, (chr 120-$X), $bind{$17}, "")[$q-6];
will let you print (selectively) at the bottom of the loop. (or get ready to do a lot of speed-reading:)
eg,     ++$xx; $q==7 and print "$xx: (", length(), ') ', substr $_,0,80;
update: Oh yes, somes stats from the output:
5801 substitutions
longest line: 1095 chars (after 29 substitutions)
first letter at: 456th sub (length 943)
first word: 456 to 525
second word: 1314 to 1888
third word: 2813 to 3116
last word: 4125 to 4705 (length 71!)
p
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
Says jynx:
$z seems to just match any number of backticks (and $d is set to 2, although this doesn't
need to happen) or any number of characters...
Not exactly---$z will not match `
or `` or ``` or ```````.
And it will match `xy, but not `x`y.
The i and p substitutions are important for printing, but in the
grand scheme of things they're relatively unimportant.
The B, C, and S items are
much more important.
There's nothing special about %bind; it's just a regular hash.
Feel free to declare it with my %bind at the
top of the program. Running this under strict
causes Perl to panic though; I don't know why.
$13 and $14 correspond to the parts of
$_ matched by the ($z) expressions in
the ``A($z)($z) part of the pattern; similarly
$17 is the $z part from `E($z).
The really tricky part is that although it's i that
sets up the $R variable for printed (as you correctly
observed) there are only a few i's in $_---not nearly
enough to do the job. Or so it would seem. As I said, that's
the tricky part.
Well, thanks for the kind words. :)
| [reply] [Watch: Dir/Any] |
Re (tilly) 1: I refuse to explain this
by tilly (Archbishop) on Apr 10, 2001 at 01:42 UTC
|
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
Hmm... it worked for me yesterday, but Dominus changed the formatting today, and I'm now getting the same results as MrNobo1024.
| [reply] [Watch: Dir/Any] |
Re: I refuse to explain this
by strredwolf (Chaplain) on Apr 09, 2001 at 07:04 UTC
|
The main key behind it is the use re 'eval',
which allows Perl to be inside the (?{...}) considitonal
regexps. Couple that with the "e" flag on s/// and it runs
the loop.
Now when it hits the do{}while($n), $_ is ``As`SC``Ad``S``CS`CCI``Ae``C`SI`Ed``A?``B``BIi`pI``E?``Es``C``Es``Es`
+`Es``Es``Es`KI```BI``Es``Es``Es`KI``Es``Es`KI``E?``Es``Es``Es`KI``E?`
+`Es``Es``Es``Es``Es`KI``E?``Es``Es``Es``Es`KI``E?``Es``C``Es``Es```BI
+``Es``Es``Es`KI``Es``Es``Es`KI``Es``Es``Es`KI``E?``Ee``Ee``Es``Es``Es
+``Es``Es`KI``E?``Es```BI``Es``Es``Es`KI``Es``Es`KI``E?```BI``Es``Es``
+Es`KI``Es``Es`KI``E?``Es``Es``Es``Es`KI``E?```BI``Es``Es``Es``Es`KI``
+Es``Es`KI``E?``Ee```BI``Es``Es``Es`KI``Es``Es`KI``E?``Ed``Es``Es``Es`
+KI``E?``Es``C``Es``Es```BI``Es``Es``Es`KI``Es``Es``Es`KI``Es``Es``Es`
+KI``E?``C``Es```BI``Es``Es``Es`KI``Es``Es`KI``Es``Es``Es``Es`KI``E?``
+Ee```BI``Es``Es``Es`KI``Es``Es`KI``E?``Ed``Es``Es``Es`KI``E?``C``Es``
+Es``Es``Es`KI``Es``Es``Es`KI``E?``Es``C``Es``Es```BI``Es``Es``Es`KI``
+Es``Es``Es`KI``Es``Es``Es`KI``E?``C```BI``Es``Es``Es``Es`KI``Es``Es`K
+I``Es``Es``Es`KI``E?``Ee``Ee``Es``Es``Es``Es``Es`KI``E?``C``Ee``Es``E
+s``Es`KI``Es``Es``Es`KI``E?``Ee``Ed``Es``Es``Es`KI``E?``Ee```BI``Es``
+Es``Es`KI``Es``Es`KI``E?``Ed``Es``Es``Es`KI``E?``Ed``Ee```BI``Es``Es`
+`Es`KI``Es``Es``Es`KI
Hmmm, it looks like a bit of source code and a state engine
to me!
--
$Stalag99{"URL"}="http://stalag99.keenspace.com";
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
Hmmmm, looks kinda like unlambda (the lower case, anyway).
p
| [reply] [Watch: Dir/Any] |
|
Says petral:
looks kinda like unlambda
Wow, great catch!
I had forgetten all about unlambda, and I owe you big thanks for
reminding me. You are absolutely correct. You can
think of this program as an interpreter for a language
very similar to unlambda. In particular, the I,
`,
S, and K have exactly the same meaning as
in unlambda.
Now I don't have to refuse to explain the program;
I can just point to the
unlambda web pages. There are
a bunch of variations here, but if you understand
unlambda, it should be easy to understand this program.
(That is something of a poisoned apple, because hardly anyone does
understand unlambda.)
Everyone should give petral a big ++ on this
for being so clever.
| [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
I did. But I'll agree that it's helps shorten it (sub
in regexp?).
But expanding $_ out does make it look like you're doing
a virtual machine inside of the s///ex regexp. Source code
(or is it VM machine code?) and a state engine, like my own
obfusc.
--
$Stalag99{"URL"}="http://stalag99.keenspace.com";
| [reply] [Watch: Dir/Any] |
|
|
|
Re: I refuse to explain this
by MrNobo1024 (Hermit) on Apr 10, 2001 at 01:09 UTC
|
When I run this nothing happens. Is there supposed to be a /x modifier on the qr//? | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
|
I put in the 'x' modifier on the qr//, and it has fixed it. Looks like Dominus' update is causing some confusion.
MeowChow
s aamecha.s a..a\u$&owag.print | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
Re: I refuse to explain this
by Dominus (Parson) on Mar 15, 2010 at 19:21 UTC
|
| [reply] [Watch: Dir/Any] |
Re: I refuse to explain this
by MeowChow (Vicar) on Apr 10, 2001 at 03:13 UTC
|
We give up. Start explaining =) | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
A reply falls below the community's threshold of quality. You may see it by logging in. |