Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Okay so I'm a geek and I spend my Friday night writing a Perl obfu rather than going out. But hey my wife thought it was cool (which probably just means she's a geek too :) ).

This could be more obscure but I think its at least non-obvious the way it is. Will work on a standard size terminal window. *Should* work on Windows but I don't have a box in which to test that theory. Needs Time::HiRes. I did it at first without but it just wasn't as cool. Anyway, here it is:

#!/usr/bin/perl use Time::HiRes qw(usleep); $@='Just Another Perl Hacker';$@=length($@); $|=abs(2-$@);goto f;z:if(int(rand(10))>5){($- ,$.)=($",$;);}else{($-,$.)=($",$;);}@b =();$b [0] = $-;if($- ==$;){$b[1]=1;}else{$b[1]=7 + 50 + 10 + (5 * 2);}$,='l';$,='r'if$-==$";$vd ='u';$vd='d'if int(rand(10))<5;while($|){my $s="";foreach $%(0 .. 22){foreach$=(0 .. 78) {if($===39){$s.="|";}if($%==$;&& $===0){$s.= "]";}elsif($===$b[1]&& $%==$b[0]){$s.= "*";} elsif($===78&& $%==$"){$s.="[\n";}elsif($=== 78){$s.=" \n";}else{$s.=" ";}}}print $s;#### $b[1]==1 and$,='r';$b[1]==77 and$,='l';$b[0] == 23 and$vd='u';$b[0]==0 and$vd='d';if($,eq 'r'){$b[1]++;$mp=\$";}if($, eq'l'){$b[1]--;# $mp=\$;;}if($vd eq'u'){$b[0]--;$$mp-- unless $$mp==0;}if($vd eq'd'){$b[0]++;$$mp++ unless $$mp == 22;}usleep(50_000);system($^);}f:$^= 'clear';$"=int(rand(22));$;=int(rand(22));$^ ='cls'if$^O=~m|win|i;goto z;################

Suggestions welcome!

Update: Took out the need for Time::HiRes as suggested by BrowserUk

#!/usr/bin/perl $@='Just Another Perl Hacker';$@=length($@); $|=abs(2-$@);goto f;z:if(int(rand(10))>5){($- ,$.)=($",$;);}else{($-,$.)=($",$;);}@b =();$b [0] = $-;if($- ==$;){$b[1]=1;}else{$b[1]=7 + 50 + 10 + (5 * 2);}$,='l';$,='r'if$-==$";$vd ='u';$vd='d'if int(rand(10))<5;while($|){my $s="";foreach $%(0 .. 22){foreach$=(0 .. 78) {if($===39){$s.="|";}if($%==$;&& $===0){$s.= "]";}elsif($===$b[1]&& $%==$b[0]){$s.= "*";} elsif($===78&& $%==$"){$s.="[\n";}elsif($=== 78){$s.=" \n";}else{$s.=" ";}}}print $s;#### $b[1]==1 and$,='r';$b[1]==77 and$,='l';$b[0] == 23 and$vd='u';$b[0]==0 and$vd='d';if($,eq 'r'){$b[1]++;$mp=\$";}if($, eq'l'){$b[1]--;# $mp=\$;;}if($vd eq'u'){$b[0]--;$$mp-- unless $$mp==0;}if($vd eq'd'){$b[0]++;$$mp++ unless $$mp == 22;}select $`,$`,$`,.05;system($^);} f:$^='clear';$"=int(rand(22));$;=int(rand(22 ));$^='cls'if$^O=~m|win|i;goto z;###########

In reply to Perl plays Pong! by cfreak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-28 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found