Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Rusty?

by acid06 (Friar)
on Oct 03, 2004 at 05:51 UTC ( #395969=obfuscated: print w/ replies, xml ) Need Help??

use strict;use subs qw(r p j u k);my@M=split'' ," REKCAH LREP REHTONA TSUJ";my@s;for my$y(0.. $#M){for(0..79){$s[$y][$_]=" "}}my@m=@M;{push@ {$s[0]},k\@m;@m=@M if$#m<0;for(0,0){@s=r@s;u\@ {$s[$_]};@s=r@s;k\@{$s[$_]};u\@{$s[$#s-$_]};@s =r@s;my$k=k\@{$s[$#s-$_]};@s=r@s;$s[$_][j@{$s[ $_]}]=$k}p@s;redo}sub r{my@r;for my$y(0..$#_){ for my$x(0..j(@{$_[$y]})){$r[$x][$y]=$_[$y][$x ]}}@r}sub p{system'cls';for(@_){print for(@$_) }}sub u{pop@{$_[0]};unshift@{$_[0]}," "}sub j{ $#_}sub k{shift@{$_[0]}}BEGIN{$|=1}
Note1: If you're on *nix I guess you need to change 'cls' to the right clear screen command.
Note2: If you leave it running for a while it'll eventually die.
Note3: It'll complain if warnings are turned on

PS: Don't know if the 'use subs' ruined some fun, but I guess that the main thing is figuring out how it works, not trying to find hidden code.
Update: As jdalbec noted, setting on autoflush gives betters results, so I added that BEGIN "hack" in order to maintain the "metric" of the code.


acid06
perl -e "print pack('h*', 16369646), scalar reverse $="

Comment on Rusty?
Download Code
Re: Rusty?
by jdalbec (Deacon) on Oct 03, 2004 at 23:22 UTC
    I couldn't see anything on Mac OS X 10.3.5 in Terminal.app until I set $|=1;. Even on a terminal output is line buffered by default and it looks like you aren't printing any "\n"s. Update: the system 'clear' call does flush the output buffer...just before it clears the screen!

    However, I get a smoother display if I just add local $|=1;print to the end of p() rather than setting $|=1 globally and leaving it that way.

    Update: At first I tried adding system 'true' to the end of p(), which also works on Mac OS X. However, perlport says it's not portable to SunOS/Solaris and HP-UX.
Re: Rusty?
by opqdonut (Acolyte) on Oct 05, 2004 at 18:39 UTC

    Really nice! Seems you're not *so* rusty :)

    Applause


    J

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://395969]
Approved by davido
Front-paged by grinder
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-07-22 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (126 votes), past polls