Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Think about Loose Coupling
 
PerlMonks

Saturn

by eyepopslikeamosquito (Abbot)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Oct 10, 2004 at 05:33 UTC ( #397958=obfuscated: print w/ replies, xml ) Need Help??

Inspired by Cassini-Huygens mission to Saturn. Update: To run, save the obfu to a file, then run in a console window at least 90 chars wide by 46 deep. Update: fixed typo (thanks for feedback ysth) plus minor code improvements.

#!/usr/bin/perl
                                                                           ;;;;;;
                                                                       ;;;;;;;;;;;
                                                                   ;;;;;;;;;;;;;;;
                                                                ;;;;;;;;;;;;;;;;;
                                                             ;;;;;;;;;;;;;;;;;;;
                                                           ;;;;;;;;;;;;;;;;;;;;
                                                         ;;;;;;;;;;;;;;;;;;;;;
                                     +$I=sub{+s+^+     ;;;;;;;      ;;;;;;;;;
                                  $"x$_[1]+gem;$/x$_#   ;;;;        ;;;;;;;;
                               [0].$_.$/};$W=sub{$~=!q~            ;;;;;;;
                            ~.pop();system($^O=~Win?ClS:#         ;;;;;;;
                          'clear'),print,select$Z,$Z,$Z,!"       ;;;;;;
                         "||$~for@_};$H=sub{+join$/,map($_#     ;;;;;;
                        x$_[0],pop=~m-.+-g),!_};$_=!Mima,s--   ;;;;;
                       "@{['=9+)w'^RINGS]}\%;local@{[Saturn^# ;;;;;
                      wNXIBP]}"-see;s-^#!..+?$/(?=$"+;)--is  ;;;;
                     y-;-'-;s-\w-~-gi;$S=$_;#--Beautiful]  ;;;;
                     @S=m-.+-g;$N=1+.6-!th_,$--=-82-$---  ;;;
                    $_.=$"x-(y---c-$-)for@S;$R=sub{$i#  ;;;  -d
                    =0;join$/,map{$j=$%;join!_,grep#  ;;;  Rhea
                    !($j++%$_[$%]),m-.-g}grep!($i#  ;;;  -Titan
                    ++%$_[0]),@S};$L=join!_,map#  ;;;  -Huygens
                    ~~reverse.$/,@S;@R=(&$I(q-  ;;;  -&&20,051,
                    $_=_^q-q-),&$I(20,41-!q-  ;;;  -,$_=F|K),$
                    I->(15,31,$_=&$R(4-!q-  ;;;  -)),&$I(13-!"
                  ;;",28,$_=&$R(3)),&${  ;;;  _^_^I}(10,20-!"
                ;;;;;",$_=$R->(2)),q-  ;;;  -&&$S);@O=map&{"
              ;;;;;;  "&&$H}($_,&${  ;;;  R.!-_}($_))x$_,!"
             ;;;;;     "+2..2*~~2  ;;;  @Y=reverse@R#Dione
           ;;;;;;       &${m--  ;;;  S|A|T|U}(@R,$N)||!q-
         ;;;;;;;          b-  ;;;  &$W(@O[0,1,2,1,0!=!q-
        ;;;;;;;            ;;;;  -],!1!~~1);&$W($S.!q-
      ;;;;;;;;;        ;;;;;  -,$L,0.16)for$%..5+!q-
     ;;;;;;;;;;    ;;;;;;;;;    Cassini-;&{$W||q-
    ;;;;;;;;;;;;;;;;;;;;;;         -}(@Y,1.6)
   ;;;;;;;;;;;;;;;;;;;;
  ;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;
;;;;;;;;;;;
  ;;;;;;


Updated Steve_p - obfu will not display correctly if changed from "pre" tags to "code" tags. In the interest of preserving this node as the author indended, it should be left alone.

Comment on Saturn
Download Code
Re: Saturn
by Anonymous Monk on Oct 11, 2004 at 12:39 UTC
    So cool its mindboggling
[reply]
Re: Saturn
by zentara (Chancellor) on Oct 11, 2004 at 16:51 UTC
    I just looked at this with my Midnight Commander's editor mcedit,(with my custom colors), and it was so beautiful, I thought I would post a screenshot . Saturn screenshot

    I'm not really a human, but I play one on earth. flash japh
[reply]

      Thanks for that. Yep, it looks the same shape in your editor as mine, nice and round -- though yours has prettier colours than my plain ol' vi. :-) By contrast, the Perl Monks code font in my browser seems a little narrower.

      BTW, I derived the Saturn shape from this beautiful Voyager space probe photograph.

[reply]

        My colors in vim are different but the overall gradiating colors effect is the same.

[reply]
Re: Saturn
by DrHyde (Parson) on Oct 12, 2004 at 08:58 UTC
    Damnit, this rocks so hard that I want to up-vote it again!
[reply]
Re: Saturn
by BrowserUk (Saint) on Oct 12, 2004 at 09:27 UTC

    What should I be seeing here?

    This is what I am seeing:

    A blank screen, a '.' appears bottom right; the dot becomes a 'o', which in turn becomes a '~', which then moves up and left; a bunch of '~'s appear then disappear; the lone tilde return bottom right, becomes a 'o', then '.'; the end.

    Is this what I should see?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
[reply]
      I get a huge Saturn hoving into view from a distance, then doing a psychedelic kaleidoscope jig, then dancing left, then right, then left again, then disappearing.

      I think you're missing the important parts.
[reply]

        I thought I must be when I saw other peoles reaction. I mean the layout of the source is way cool, but the runtime effect (that I see) was ... well...a bit disappointing. Guess I'll try and work out why now. Thanks.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
[reply]
[d/l]
      A blank screen, a '.' appears bottom right...

      I think that is the problem: the '.' should appear in the middle. I should have originally stated that you must run the obfu in a console window big enough so that when you cat the source code it does not wrap and you can see it all -- 90 characters wide by 46 deep should be plenty. If that turns out not to be the problem, I'd be interested to know the perl version and platform you are running (I've tested it on Linux and Windows with Perl versions 5.005, 5.6 and 5.8 (with and without warnings)).

[reply]

        And you have to run the script to a file (that supports seek). It sounds like the BrowserUK fed the script to perl on STDIN, which makes for a very boring show.

        - tye        

[reply]

        Size wasn't the problem, my consoles are 200x100; in fact I did try reducing it to various standard sizes to see what difference it made. Nada.

        Tye hit the nail on the head. I am in the habit of pasting obfu source directly into a command session with perl waiting for input. AS he said it makes for a very boring show.

        Once I put the code into a file and ran it.....what can I say to make up for my blaspheming?

        Saturn obfu is very, very cool!

        I'm a closet space nut. My desktop backdrop varies between the latest images from HST (It must be fixed), the Rovers, and Cassini-Huygens. It's currently The last Ultra Deep Field image (very large jpg), but if I ever get around to putting some of the C-H sequences together as a screensaver, I just might spend more time doing nothing, just so it will run.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
[reply]
Re: Saturn
by mhearse (Hermit) on Oct 12, 2004 at 14:52 UTC
    That's definetely the coolest obfu I've ever seen. Well done.
[reply]
Re: Saturn (typo)
by eyepopslikeamosquito (Abbot) on Oct 13, 2004 at 23:22 UTC

    D'oh, just realised I made a typo on the 4th last line of Saturn's body, using a comma instead of a dot. That is, instead of:

    $D->($S,!q-

    I meant to type:

    $D->($S.!q-

    Oh well, that typo seems to have created an "accidental" visual effect. :-) If you make the one character change described above, you'll notice the "Saturn tilt sequence" runs faster and without flicker. Not sure which one looks better however. Update: fixed the typo in the root node after feedback from ysth.

[reply]
[d/l]
[select]
      Much better with the change. I notice on the 5th image of the approach, there are three missing rows on the bottom that chop off part of the rings. Is this just me?
[reply]

        I can't see it. You might try running the obfu redirecting stdout to a file, then cutting and pasting the offending shape so we can see it. I just did that and the 5th image (a half size Saturn) looked ok to me and was 21 lines long (exactly half the 42 lines in the obfu). Here it is.

        ''' ''''''' ''''''''' '''''''''' $~~~-~'/$# '' '''' {~~~~~~(^=~~~~# '''' ~~~@)'~~~~~(/~~$# ''' @[=+'~~]\\'~~@[~~~#''' ---~\--~$=~#-~~~~] '' $.$~(----~~~$=~{~ '' ~ !$+%~$],--}~~(~ '' ~~~ (~~~./@)@=&~~ '' &~,~, ~>~,~$=$(-~ '' ),$(~! ''',~$-(),- ' -&~'~~~{ '' +.~~~ ' @=~~~@#~~ ''' ~ '' $(~~~~~~!~ ''''' '' -$,.~~~%.+~ ''''''''''' }@,.) ''''''''' ''''''' '''

        The algorithm to create a half-size shape is to take lines 1,3,5,... and for each line to take chars 1,3,5,... (this is done in sub $R).

[reply]
[d/l]
        I see the same effect. Moreover, during Saturn's left-right dance, the bottom of the rings is always displayed at the lower-right corner. But this is only a visual effect, I tried OP's suggestion of redirection and all seems good.

        Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

        Don't fool yourself.
[reply]
Re: Saturn
by holli (Monsignor) on Jan 09, 2005 at 09:45 UTC
    brillant!
[reply]
Re: Saturn
by olivierp (Hermit) on Jan 10, 2005 at 20:09 UTC
    I don't like obfu in general, but yours really earns its ++'s

    --
    Olivier
[reply]
Re: Saturn
by TilRMan (Friar) on Jun 13, 2005 at 05:21 UTC
    I saw some strange misbehaviors others have seen. I think the trick was changing the network newlines (\r\n) to local newlines (\n).
[reply]
[reply]
[d/l]
Re: Saturn
by Panda (Scribe) on Jul 30, 2006 at 21:03 UTC
    This is so cool I want to up-vote it again!

    P

[reply]
Re: Saturn
by Tabari (Monk) on Aug 14, 2007 at 07:25 UTC
    Not original to up vote again, but irresistible
    Tabari
[reply]

Back to Obfuscated Code

Login:
Password
remember me
What's my password?
Create A New User

Node Status
node history
Node Type: obfuscated [id://397958]
Approved by tachyon
Front-paged by tachyon
help
Community Ads
Chatterbox
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users
Others examining the Monastery: (13)
ikegami
GrandFather
jdporter
atcroft
herveus
thezip
Eyck
MonkE
ssandv
vitoco
gnosti
wanradt
im2
As of 2009-11-21 04:20 GMT
Sections
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth

Future historians will find that the material characteristic of the current era is...

Aluminium
Plastic
Oil
Water
Carbon dioxide
Copper
Iron
Silicon
Salt
Uranium
Hydrogen
Other

Results (726 votes), past polls