Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Really bored at work JAPH

by karl_heinrich (Acolyte)
on Oct 31, 2002 at 20:52 UTC ( [id://209521]=note: print w/replies, xml ) Need Help??


in reply to Really bored at work JAPH

Ok, here's an improvement on my previous post:
#!/usr/bin/perl -w use strict; my@AoA;my@tmp;my($x,$y);my$w=20;my$h=20;my( $tmp,$tmp2,$tmp3);for$x(0..$w){for$y(0..$h) {$AoA[$x][$y]=sqrt(($x-0.5*$w)**2+($y-0.5*$ h)**2)/10;}}foreach(0 .. 3){if(2*$_+1==1){$ tmp2++;}elsif(2*$_+1==3){$tmp+=2*$_+1;}else {$tmp*=2*$_+1;}}$tmp+=$tmp2;$tmp[0]=$tmp;## $tmp2=1;$tmp3=2;foreach(1..3){$tmp2*=$_;}## foreach(1..2){$tmp3**=2;}$tmp=$tmp2*$tmp3+1 ;$tmp[1]=$tmp;$tmp=13;$tmp+=(81**(1/4))**2* ('1'.'1');$tmp[2]=$tmp;$tmp=1;foreach(1..3) {if(2*$_!=6){$tmp *= 2*$_;}else{$tmp*=((4*$ _)+1);}}$tmp[3]=$tmp;for$x(0..$w){for$y(0.. $h){if($AoA[$x][$y]>=0&&$AoA[$x][$y]<=0.25) {print chr($tmp[0]);}elsif($AoA[$x][$y]>=## 0.25&&$AoA[$x][$y]<=0.5){print chr($tmp[1]) ;}elsif($AoA[$x][$y]>=0.5&&$AoA[$x][$y]<=## 0.75){print chr($tmp[2]);}elsif($AoA[$x][$y ]>=0.75&&$AoA[$x][$y]<=1){print chr($tmp[3] );}else{print' ';}}print"\n";}#############
Lemme know what you think. Thanks.

Replies are listed 'Best First'.
Re: Re: Really bored at work JAPH
by jynx (Priest) on Oct 31, 2002 at 23:23 UTC

    *sigh*, hopefully this will be constructive as well...

    Essentially the problem i see is that you are making one of the first-poster mistakes while using a useful/interesting technique. This is a problem because of the axiom "whitespace does not an obfu make". If we apply white space to your code it becomes fairly obvious what you're doing.

    The algorithm you use is a good solid place to start, and i think it's beauty. Unfortunately it's a one-trick pony. No offense, but your rehash isn't that obfuscated either since all that has happened is more code made it's way into the process. More code doesn't mean harder to read, just more to read.

    If you want to obfuscate the code more you can't tell the audience where the data is originating and/or how it's set up. In the case of this piece you tell people you're using an array of arrays and you explicitly use $x and $y in your code, which is a dead mathematical giveaway.

    So, you've got a good start: an original idea (to you at least). From there you've implemented it (an important step because it proves it can be done; i've not submitted many an obfu because i couldn't implement it to begin with!). The next step is to cull the code for redundancies and easy to read bits. As always, using built-ins and interesting names for variables is usually a plus. As an example, one direction you could have gone for a twist of this obfuscation is on my scratchpad...

    jynx

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://209521]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-25 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found