Your skill will accomplishwhat the force of many cannot PerlMonks

### Object Oriented?

by jryan (Vicar)
 on Sep 05, 2001 at 07:12 UTC Need Help??

```#!/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:

1. ball
2. banana
3. lamp
4. block
5. exit
6. and a secret (ok maybe not too secret...) command!

Things to note:

1. Please dl code rather than copy/paste (or if you MUST copy/paste, put a blank line at the end)
2. Either way, please save to a file and run from there.
3. 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 :)

Replies are listed 'Best First'.
Re: Object Oriented?
by jryan (Vicar) on Sep 05, 2001 at 18:14 UTC

A few unfortunate monks on win 2000 told me they were having problems running this... which is kinda odd considering it was written on a win 98 machine (hey, its all I've got at home). However, as not to alienate those poor souls, here's a few screenshots of it working: (although I still won't show you the secret command! :p)

ran fine on win2k for me

@:::::::((==========Rydor====>
Very nice piece of work! worked on my windoze2000 with activestate perl 5.6.1
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
Binary build 626 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 01:31:15 May 2 2001

A-OK :) good work
Re: Object Oriented?
by Anonymous Monk on Sep 06, 2001 at 03:16 UTC
obive
or possibly objective

Create A New User
Node Status?
node history
Node Type: obfuscated [id://110213]
Approved by root
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-08-17 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Who is your favorite scientist and why?

Results (282 votes). Check out past polls.

Notices?