#!/usr/bin/perl -w # Object Oriented?
use strict;
package # a ball?
ball;my%bal;sub # is a ball an object?
new{shift;my@ball=@_; # maybe... but what if it
for(my$ball=0;$ball<@ball # gets lost... how can you
;$ball++){if(!$ball<16){$ball # prove it was there in the
[$ball]=~s+(.{31}).*+$1+x;$,="" # first place?
;}$ball[$ball]=~y=a-lmn-zA-Z=x=
if($ball<16);my $b;$ball[$ball] #
=~y=!-@[-_{-~=x=; $ball[$ball ##
]=~s+x\sx+xxx+gx if($ball <16
);$ball[$ball]=~s+.*+ s!.*
!!x+sex unless( $ball # a banana?
<16&& $ ball>2 # is a banana
);$ball[ # an object?
$ball]=~ # maybe... but
s+1++gx;}; # what if it
print@ball} # gets eaten..
package main # how can you
;;;;open(OUT, # prove it was
$0 );; my @in; # there in the
@ in= <OUT> ;; # first place?
package banana;
;sub new{shift;
my @banana=@_;;
map( y=!-~=x=,@
banana);map(s+x
s?\sx+xxx+gx, @
banana);for (my$
banana=10; $banana
<@banana;$banana++){
if($banana<37){substr
($banana [$banana ]
,0, 41-$ banana)=~
y=!-~= =; ;;
$banana[$banana]
=~s+(.{53}).*+$1+; # a lamp?
print $banana[$banana] # is a lamp
;}}}package lamp;;sub new{ # an object?
my$lamp={}; my@lamp=@_[39..63] # maybe...
;$lamp->{lamp}=[@lamp]; grep (map( # but what if
y=!-~=x=, @{$lamp->{lamp}}), @{$lamp-> # it gets
{lamp}});;; grep(map (s/x\sx/xxx/, @{$lamp-> # turned off?
{lamp}}),@{$lamp->{lamp}});for(my$lamp1=0; $lamp1< # how can you
@{$lamp->{lamp}};$lamp1++){substr($lamp->{lamp}->[ # prove it was
$lamp1],0,15-$lamp)=~y=!-~= = if($lamp>15);$lamp-> # there in the
{lamp}->[$lamp1]=~ # first place?
s+(.{53}).*+$1+x ;
} bless $lamp;}; ;
sub return_data{my
$lamp=shift;return
@{$lamp->{lamp}};}
package main;while
(){print ">";$_=<>
;$_= new ball(@in)
if(/^ball$/) ;$_ =
new banana(@in) if
(/^banana$/);if(/^
ob(ject)?ive$/x ){
my@object=qw/real?
even anything Is object?
an really anything Is/;;$, # a block?
=" ";print reverse @ object # is a block an object?
;;print "\n";};if(/^lamp$/) # maybe... but what if it
{$_=new lamp(@in);;print($_ # crumbles? how can you
->return_data)}if(/^block$/ # prove it was there in the
){my@block=@in;map(y= -~=x= # first place?
,@block);; for(my$block=65;
$block<$#block+1;$block++){
$block[$block]=~s+(.{27}).*
+$1+x;print$block[$block]}}
exit if(/^exit$/)}close OUT
This obfu is command driven (meaning you have to type stuff to make it do stuff). The commands are:
- ball
- banana
- lamp
- block
- exit
- and a secret (ok maybe not too secret...) command!
Things to note:
- Please dl code rather than copy/paste (or if you MUST copy/paste, put a blank line at the end)
- Either way, please save to a file and run from there.
- Don't vote just because of the presentation ascii... I think it makes it look cool (and its a lot more work to do) but theres more to this piece than that. Also, I welcome anyone who would like to review/decipher it!
Update: Run the program, and THEN input the commands. It has sort of a mini-shell. Don't try to input the commands with command line flags, because it wont work :)