We don't bite newbies here... much PerlMonks

### ASCII arithmetic

by martin (Friar)
 on Sep 29, 2010 at 10:16 UTC Need Help??

```\$%=2,\$"=6;\$;=ord"\c?";print+map{\$%*="@_[4,4,
]";\$=-=\$=;\$=*=\$%%=\$;,\$=+=ord,\$=%=\$;for@_;chr
\$=}@_=split?,*?,q=|f475!%L(wz)Hmqkcz?ar~x<m=

This one won't work correctly on an EBCDIC machine, I am afraid. But you can turn on strictures and warnings if you like.

Replies are listed 'Best First'.
Re: ASCII arithmetic
by hbm (Hermit) on Sep 29, 2010 at 18:41 UTC

I understand what you are doing:

```\$%          = 2;
\$"          = 6;
\$;          = 127;
@_          = qw(124 102 52 55 53
33 37 76 40 119 122 41 72
109 113 107 99 122
63 97 114 126 120 60 109);
for (@_) {
\$=       = 0;
\$%      *= 565;
for (@_) {
\$%   %= 127;
\$=   *= \$%;
\$=   += \$_;
\$=   %= 127;
}
print chr \$=
}

But the beauty, I'm sure, is how you arrived at those numbers - and I'm left wondering.

Re: ASCII arithmetic
by ambrus (Abbot) on Sep 29, 2010 at 15:19 UTC

Beautiful. This is the best take so far on the kind of japhs

that contain the coefficient of a polynomial which has to be evaluated to get the message. This one contains two extra twists: firstly the variable substituted is not adjacent integers, secondly you use punctuation variables in such a confusing manner that it's not at all obvious which variable is used for its original special purpose.

The truly beautiful thing is how there are no control characters in the string encoding the coefficients (and it's even one character shorter than it should be). I don't understand how you did that, because if I try to modify this japh, then the string I get is full of control characters, making the code much longer:

```\$%=2,\$"=6;\$;=ord"\c?";print+map{\$%*="57 @_[4
]";\$=-=\$=;\$=*=\$%%=\$;,\$=+=ord,\$=%=\$;for@_;chr
\$=}@_=split//,"'QV\bjC\cu-\am\cy\cr#i\"HHuM\cb`w,\t_4"
(Sorry for the way I messed up the string at the end of the first line, I don't have patience to fix that now.)

Update: striked out the part about the polynomial being too short, that's my mistake.

Create A New User
Node Status?
node history
Node Type: obfuscated [id://862574]
Approved by Corion
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
As of 2018-03-21 01:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (263 votes). Check out past polls.

Notices?