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

Saturn

by eyepopslikeamosquito (Canon)
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
Re: Saturn
by zentara (Archbishop) 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

      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.

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

Re: Saturn
by DrHyde (Prior) on Oct 12, 2004 at 08:58 UTC
    Damnit, this rocks so hard that I want to up-vote it again!
Re: Saturn
by BrowserUk (Pope) 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
      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.

        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
      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)).

        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        

        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
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.
Re: Saturn (typo)
by eyepopslikeamosquito (Canon) 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.

      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?

        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).

        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.
Re: Saturn
by holli (Monsignor) on Jan 09, 2005 at 09:45 UTC
    brillant!
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
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).
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

Re: Saturn
by Tabari (Monk) on Aug 14, 2007 at 07:25 UTC
    Not original to up vote again, but irresistible
    Tabari
Re: Saturn
by vinian (Beadle) on Dec 04, 2011 at 17:32 UTC
    veryyyyyy cooooool, both code and the output
Re: Saturn
by chacham (Curate) on May 01, 2014 at 13:27 UTC

    Nice!

Log In?
Username:
Password:

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
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (15)
As of 2014-08-27 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (242 votes), past polls