Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Bad ascii art

by muntfish (Chaplain)
on Aug 25, 2004 at 15:20 UTC ( [id://385700]=obfuscated: print w/replies, xml ) Need Help??

Trying to do an obfu with Ascii Art... but I have no artistic talent. Therefore I probably ought to tell you that it is supposed to be a fish - as in muntfish.

Not sure if the method of generating the string is really obscure enough, either. I'd be glad to hear any comments and criticisms!

$c=109;for(split//," / ++++++ ++o-------=++ ++ ++_--------------<+ ++,+++++++++ +/ -------- -- -/ "){/\s/?():/[\-\+]/?eval"\$c$_$_":print chr($c)}
s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&;

Replies are listed 'Best First'.
Re: Bad ascii art
by perldeveloper (Scribe) on Aug 25, 2004 at 21:00 UTC
    I'd say the idea is not too complicated -- for every + you increase the ascii code, for every - you decrease it. In between, at every non-space character, you print the character corresponding to it. Or something like that, fact is it took me about 2 minutes to figure this out, and I think it's because the main body of the program is obvious (the for through each character loop).

    How about the following suggestions to `improving the non-readability of your code':
    1. Use special Perl variables ($/ $= $,)
    2. Avoid overusing obvious keywords (eval, split), go for regexps if possible
    3. When using regexps, feel free to use characters other than forward slashes
    4. When quoting strings, feel free to use other quoting techniques (qq[])
    I made a few superficial changes based on what I said, but I don't have Perl here, so I'll hope you at least get the idea if it doesn't run. Oh and I don't mean to offend if you already knew these things.
    $==109;for(split//,q{ / ++++++ ++o-------=++ ++ ++_--------------<+ ++,+++++++++ +/ -------- -- -/ { ){m?\s??():s:-|+:$=$&$&:?eval:print chr($=)}

      Thanks for the suggestions - and for not slagging off my code too much!

      I like your changes, although I can't get them to work. I notice you have q{{ which I fixed to q{}, also you need to escape the + in the substitution regex. But now all I get is a long line of mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm !

      I'll keep looking, hopefully I will learn something by fixing it! Thanks again.

      Update: Also need to escape the $= in the right hand side of the substitution... which gives the result:

      mmmmmmmmmmmmmmmmmsssunppprtfgggirrrrssssssskkkkkiiiiiiiiihhhhhhhhhhhh

      which has all the right letters (in the right order) but a "few" extra ones!

      s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&;
        Well, I hope I'll make it up to you with this adaptation, which I did test on Perl. It's a bit more obscure than what I originally suggested -- yet still same principles.
        $=+=49;$;= q; .;; m; | ;?49:s|\+\|-|\$=$&$&|? eval:$;=~s;.$;$=$&$&;for split//,q; / ++++++ ++o-------=++ ++ ++_--------------<+ ++,+++++++++ +/ -------- -- -/;; $_=$;;s;..$;;;print eval;
        I left the ascii art to you.

        OK, it's the m?? that is upsetting it. White space is not being filtered. The following works - but I'm going to start again to find a more obscure way of generating the characters...

        $==109;for(split//,q{ / ++++++ ++o-------=++ ++ ++_--------------<+ ++,+++++++++ +/ -------- -- -/ }){m^\s^?():s:-|\+:\$=$&$&:?eval:print chr($=)}
        s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://385700]
Approved by ybiC
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2024-04-19 07:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found