Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
Your skill will accomplish
what the force of many cannot
 
PerlMonks

spiraling quine

by Len (Friar)
 | 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 Jun 20, 2002 at 15:23 UTC ( #176043=obfuscated: print w/ replies, xml ) Need Help??

This self-reproducing code prints a turning spirale filled with it's own code. Turning speed depends on processor speed. Comments welcome.
#!/usr/bin/perl $_=' $q ="\ 47"; wh ile ($ ;= $z += .5 ){ %c= $r=0;$/ ="";whi le(2 0+ $z>($;+=.05)){$c{int$ _+ 2 6+ 2*($ r+= .0 2) * s in$ ;}{1 -$_ +1 0+ int $r*c o s $ ;} =1for(0. .1) }$ t =r ever se;$ /. =` c le ar `. " #! / usr /bi n/ pe rl \n\ $_ =$q \n" ; fo r$y (1..20){$c{$_} { $ y }? $ /.=chop$t : ($/ . =" \4 0") for(0. .53) ; $/. ="\n"}pri nt"$/$ q; s; ". chr(9 2)."s;;g;eval\n "} ';s;\s;;g;eval

Comment on spiraling quine
Download Code
Re: spiraling quine
by thelenm (Vicar) on Jun 20, 2002 at 15:27 UTC
    My only complaint is that I don't have the ability to upvote it multiple times. :-) That is absolutely incredible. Good work!!

    -- Mike

    --
    just,my${.02}

      I totaly aggree. That kind of code just shows me how mutch more I have yet to learn. Keep it up Len. (++) :-)

      ---If it doesn't fit use a bigger hammer
Re: spiraling quine
by sschneid (Deacon) on Jun 20, 2002 at 18:10 UTC
    (++) ...wow. quite incredible, if i do say so myself.
Re: spiraling quine
by Marza (Vicar) on Jun 20, 2002 at 20:06 UTC

    Really slick! Only had to change clear to cls as I have a PC.

      Really slick! Only had to change clear to cls as I have a PC.

      s/PC/DOS or Win32 based PC/;

      PCs can run many different operating systems, and Windows is just one of them. Unixish operating systems use "clear", DOS (and Win32) systems use "cls", but it can be something completely different. If you want to extend your computer (or PC :) knowledge, or just dislike Windows' instability, try some operating systems, like Linux or FreeBSD. Many are free.

      - Yes, I reinvent wheels.
      - Spam: Visit eurotraQ.
      

Re: spiraling quine
by cecil36 (Monk) on Jun 20, 2002 at 20:40 UTC
    My upvote has just crossed over into...the Twilight Zone.
Re: spiraling quine
by phrenesis (Initiate) on Jun 21, 2002 at 12:54 UTC
    This is really cool, too bad im a n00b and cant vote on it yet :) Phrenesis
Re: spiraling quine
by BrowserUk (Apostle) on Jun 21, 2002 at 14:09 UTC

    Brilliant. A real clever twist on the theme.

Re: spiraling quine
by Anonymous Monk on Jun 21, 2002 at 19:07 UTC
    Easily the strangest thing I've seen in code. Jolly good work, Len.
Re: spiraling quine
by RMGir (Parson) on Jun 21, 2002 at 19:54 UTC
    Wow.

    /msg'd myself, I definitely want to ++ this tomorrow...

    What were you drinking when you thought this up, though? :)
    --
    Mike

Hypnotic
by perlmoth (Hermit) on Jun 27, 2002 at 12:20 UTC
    I lost an hour playing with this code this morning. Now I feel a strange compulsion to ++ all your nodes.
please delete
by NodeReaper (Curate) on Jun 27, 2002 at 16:25 UTC

    Reason: neophyte delete (requested by author)

    For more information on this node visit: this

      Wow. My head's spinning.... One of the best obfuscateds I have seem.
      Tnx Olecam.

      I've done some minor changes to the Windows code.

      Putting the system("cls") just before the print gives a better flicker-free image.
      And because system("cls") has more chr's than `clear` some frames (for example the 5th frame) are not self-replicating because the output code is incomplete. So I've decreased the radius of the spiral a bit so all the code fit's in it....

      #!/usr/bin/perl $_=' $q= "\4 7" ;wh ile($;=$z+=.5 ){ %c =$r =0;$/="";while( 21+$ z> ( $; +=.05)) {$c{i nt $ _+ 26 +2*( $r+=. 0 1 9 )*s in $; }{1 - $_ +10+int$r*c os$; }=1 f or(0..1)}$t=re v e r s e; $/. =`cl s` ." #! /u sr /bi n/ pe rl \n\ $_=$q\n" ;f or $y (1. .20){ $c {$ _ } { $y }? $ /.= chop$ t:( $/ . ="\4 0")for( 0..53 ); $ /.=" \n"}system("cls ") ;p ri nt "$/$q;s ;". c h r(92) ."s; ; g; eva l\n" } ';s;\s;;g;eval
        The version for *nix kind of worked on Win32, if you screwed your eyes up. I was impressed with 'just' that.

        Having read on and found this (the Win32 version) - I'm blown away!
Re: spiraling quine
by johnirl (Monk) on Jul 12, 2002 at 15:29 UTC
    Fantastic Len!!

    recently at my first day in my new job my boss said we going to require you to do mostly perl programming. I said no problem always willing to learn a new language. He said we expect you to be up too this level in a few weeks and showed me this code.
    Frightened the life out of me.

    Cool code though. :-)

      Sounds like a cool place to work in :)
Re: spiraling quine
by RocketPro (Initiate) on Oct 21, 2002 at 23:56 UTC
    Yeah, um... on Windows NT it looks like crap... too bad there isn't a way to clear the window.
      The initial version of this code was designed for *nix.

      However, there is a Windows version available as well.

Re: spiraling quine
by wufnik (Friar) on Jul 25, 2003 at 12:15 UTC
    beautiful; your spiral the best tool for perl evangelism i have know of. should be sent to hofstadter for inclusion in his next volume.

    wufnik

    -- in the world of the mules there are no rules --

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

Node Status?
node history
Node Type: obfuscated [id://176043]
Approved by ferrency
Front-paged by rob_au
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (24)
Fletch
ww
jdporter
FunkyMonk
holli
Gavin
atcroft
Khen1950fx
jethro
kennethk
thezip
Eyck
tsee
LanX
pemungkah
5mi11er
roho
ssandv
je44ery
molecules
MikeDexter
perly_newbie
AriSoft
im2
As of 2010-02-09 22:40 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?

What level of existential comfort do you require?

Palace
Executive suite at the best hotel
Regular hotel in a decent part of town
Motel
Boarding house
Sleeping Bag on Couch in Basement
Any port in a storm
Camping under the freeway overpass
Jail
Other

Results (283 votes), past polls