Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

(Ab)using or

by chargrill (Parson)
on Feb 19, 2006 at 07:39 UTC ( #531224=obfuscated: print w/ replies, xml ) Need Help??

Not sure of my fascination with this, but liverpole's Spatial Japh got me interested in animated ascii graphics. That, along with greats such as How to (ab)use map and How to (ab)use substr and my own contribution to the (ab)use series (Ab)using fo(u)r...... all inspired me to abuse 'or':

#!/usr/bin/perl $oar=3;$nor=0;$xOr=0;use Time::HiRes qw(usleep );$oAr=5;sub or{for my$xor(0 ..9){for my$or(0..65){$ oar[$xor][$or]=' '}}}%or=(aor=>2 ,bor=>4,cor=>3,dor=>4,eor =>6,gor=>7 ,hor =>6, jor=>8 ,lor=> 27,mor=> 30, nor => 61, oor => 63,por=> 64 ,qor =>65); while( 1){ for$ OR(a..d ){if(( $OR eq 'b')or($ OR eq'c' )){$or {aor}++ ;$or{cor }++;$or{ dor}++; $or{eor} --;$ or{ gor}--;$ or{jor} --;}else {$or{aor }--;$or{ cor}--; $or{dor} --;$ or{ eor}++;$ or{gor}++;$ or{jor}++;}& or;for([ $or{aor} ,$or{bor}],[$or{aor},$or{ lor}],[$ or{bor}, $or{mor}],[$ or{bor}, $or{nor} ],[$ or{ cor},$or{ oor}],[ $or{cor} ,$or{por }],[$or{ dor},$ or{qor}] ,[$ or { eor},$or {qor}] ,[$ or { gor } ,$ or{por}] ,[$or{ gor},$or {oor}],[ $or{hor} ,$ or { nor}],[ $ or{hor},$ or{mor}] ,[$ or{ jor},$ or{ lor}],[$or {jor },$ or{bor}], [$or{hor},1 ],[$or{bor} ,1],[$or{ aor},$ or{ bor}]){nor($ _->[0],$_->[ 1])}oar ($ OR);usleep( 300000);}}sub ore{$OR=shift ;$oar=3;if( $OR eq'a'){$ oR=sub{uc shift}}if($OR eq'b'){$oR= sub{shift}} if($OR eq'c' ){$ oR=sub{'-'}}if($ OR eq'd'){$oR= sub{shift}} $yor=',rekc' .'ah '.'lraoP '.'rehtona tsuJ';@ or =split//,~~ reverse$yor; for($oar..((length$yor)+$ oar-1)){$ oar[$oAr][$ oar++]=&{$oR }(shift@or)}}sub nor{($xor,$or)=@_; if(($xOr!=0 )&&($nor!=0) ){while(($xOr!=$or)or($nor!=$xor)){ if($xOr<$or ){$xOr++}if( $nor<$xor){$nor++}if($xOr>$or){$xOr --}if($nor> $xor){$nor-- }$oar[$nor][$xOr]='*'}}$xOr=$or;$ nor=$ xor } sub oar{ore( shift);$ore=0;print"\e[2J\e[H\n" ;for(@oar){ for(@{$oar[$ ore]}){print"$oar[$ore][$orr]" ;$orr++ } $ ore++;$orr=0 ; # do not { or not # nor # { # oar # } # ore # { # or # oar # or } # ; ; $# or $# ; print "\n" } }# or # or # ore # nor # or # oar # or # ; # or { # } } # { # xor # nor # or # oar # } orr # ore # xor # nor #

It might not work on windows, but I can't test there anyhow.

And in case you can't tell, it's sort of supposed to be rotating :)

Enjoy!



--chargrill
$/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );

Comment on (Ab)using or
Select or Download Code
Re: (Ab)using or
by zshzn (Hermit) on Feb 19, 2006 at 11:36 UTC
    Abuse is right, that's a horrible pun!

    But a sweet obfu, ++

Re: (Ab)using or
by turo (Friar) on Feb 19, 2006 at 16:42 UTC

    cool!

    The code indent: 10
    The ascii animation: 10
    The ascii art: 7

    What is that thing? ... seems to be a submarine, or a 2║World War grenade

    Anyway, i like it ^_^> ...
    I've tried to do an animated stuff once, but without any ascii art (Another Monk, Another JAPH) ... and of course, not so spectacular ... I'll add your bomb-node to my favourites links ;)

    perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'

      I guess the fact that "oar" rhymes with "or" plus my hint wasn't enough. It's supposed to be an oar, the kind which is used to row a boat. I was hoping my mangling of 'Perl" (Poarl) would help people see that's what it's supposed to be. I suppose I should've <b></b>'d 'oar', maybe that would've helped further?



      --chargrill
      $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );

        Argh!, i'm a little bit slow today... I supposed your 'oars' were like a 'roars' screamming a big big 'orrr' ...

        Umm, an oar ... i can't see the oar :-D ...

        I suppose we can call it Art ;-)

        Anyway, its not your fault, it's mine ... the image of an oar is linked into my mind to the spanish word 'remo' ... sorry.

        Regards
        turo

        PS: good obfuscation work ;)

        perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'
Re: (Ab)using or
by rhesa (Vicar) on Feb 19, 2006 at 17:01 UTC
    Perl harbor.
Re: (Ab)using or
by liverpole (Monsignor) on Feb 19, 2006 at 18:44 UTC
    Very nice ++ chargrill!

    Yes, it will run under Windows, if you install and use Win32::CONSOLE::ANSI.


    @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"

      Well, it does "run" without Win32::Console::ANSI, but the oar doesn't rotate in place and looks a little, er, odd.

      -- vek --

        Heh. Even on the 'target' platform(s), I'd say it's safe to say the oar still looks 'odd' :)



        --chargrill
        $/ = q#(\w)# ; sub sig { print scalar reverse join ' ', @_ } + sig map { s$\$/\$/$\$2\$1$g && $_ } split( ' ', ",erckha rlPe erthnoa stJu +" );
Re: (Ab)using or
by wulvrine (Friar) on Feb 23, 2006 at 12:40 UTC
    OH the abuse!

    Very nice, but my head is still spinning 'oorrrr' is it my screen.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-11-23 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (128 votes), past polls