Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Magic 8 Ball

by suaveant (Parson)
on Jun 27, 2005 at 21:31 UTC ( [id://470390]=obfuscated: print w/replies, xml ) Need Help??

Look into the Magic 8 Ball to find the answers you so need. This will work WAY better than brian's Guide to Solving Any Perl Problem for answering those tough debugging questions.

Perl Programmer: Why won't my code compile?
8 Ball: Yes, definately

You can't pay for that kind of help ;)

Props to Erudil's Camel Code whose code munging technique I used, good stuff
Instructions: copy to a file and execute as a normal perl script.
Magic 8 Ball is a registered trademark of Mattel

#!/usr/bin/perl use strict; $_=q`seek(D ATA,30,0);local$/;$_=< DATA>;/8{6}(.*)8{6}/s;($a=$1) =~s/\s+(8+\s+)*//g;$a=~s/X/\040/g ;my@eight=split/888/,$a;@eight=split/ 8/,$eight[rand(20)];s/(\s+88\s*(8?88)?\ s+)/$b=int((length($1)-length($eight[0] ))\/2);sprintf("%-".length($1)."s","\040" x$b.shift(@eight) )/eg;print;"88888 888888X8Outlook8 88888 Good8888Outlook8 NotXSo8Good8888 88 88 MyXReply8IsXNo8 888Don't8Count8 88888 OnXIt8888YouXMa y8RelyXOnXIt888 88 88 8Ask8Again8Late r8888Most8Likely 88888 8888Cannot8Predi ct8Now8888X8Yes88 88Yes8Definitely8 888Better8NotXXTell8YouXNow8888ItXIs8Cert ain8888Very8Doubtful8888ItXIs8Decidedly 8So8888Concentrate8and8Ask8Again8888Sig ns8Point8ToXYes8888MyXSources8SayXNo8 888Without8a8Doubt888Reply8Hazy,8 Try8Again8888AsXIXSee8It,XY es888888"`;s/\s//g;eval ;__DATA__

 

Edit: jdalbec pointed out definately if spelled definitely, teach me not to spell check my web sources :) Thanks.
Edit2 Ack! I got code crap on the perl line in the last edit! Oops.

                - Ant
                - Some of my best work - (1 2 3)

Replies are listed 'Best First'.
Re: Magic 8 Ball
by deibyz (Hermit) on Jun 28, 2005 at 10:24 UTC
    I couldn't resist to write an spoiler to this obfu:

      ( $a = $1 ) =~ s/\s+(8+\s+)*//g; # Remove center "hole" (from copy)

      This line also removes whitespace from outside the ball.

                      - Ant
                      - Some of my best work - (1 2 3)

Re: Magic 8 Ball
by marto (Cardinal) on Jun 28, 2005 at 08:44 UTC
    Q. "Does this obfu rock?"

    A. "Yes Definately"

    This is the best obfu I have seen in a while.
    Well done.

    Martin
Re: Magic 8 Ball
by radiantmatrix (Parson) on Jun 28, 2005 at 21:32 UTC
    I haven't enjoyed an obfu this much in a long time! Now, let's see someone port it to the evil version. ;)

    Yoda would agree with Perl design: there is no try{}

Re: Magic 8 Ball
by vulcanrob (Initiate) on Jul 05, 2005 at 01:06 UTC
    wow! I love this! Now I can defer all major life decisions to this script. Thanks to this script, I'm movingy to Roswell, NM to raise marmots!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://470390]
Approved by Corion
Front-paged by Limbic~Region
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2025-04-19 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.