There's more than one way to do things | |
PerlMonks |
Re^2: Bear is driving?by teamster_jr (Curate) |
on Apr 03, 2006 at 09:39 UTC ( [id://540887]=note: print w/replies, xml ) | Need Help?? |
here is a completely cleaned up version, showing what is actually run:
The call list needs to be shortened. Since X and Y are 2 digit numbers they can be turned into characters, so by changing the part of a() where they are set: we can then call them like this: which then becomes this: ie take two chars out of the string, and replace them with a"$1","$2";, then match the first call and use it to call d(); eval will run the calls, drawing the boxes.
To obfuscate, and save space i then did a form of huffman encoding, where repeated strings are replaced with a single letter, to do this the bulk of the program was but in $_, (using q^..^;) and then run through this: for each of those strings in the main block, substitute the letter (starting at A (chr 65) ) with the corresponding string, so A is $i-> B is colorAllocat( etc. finally $_ (all the code) is eval'd Before posting i run it through my obfu formatter (which i call perlmess - the opposite of perltidy :) ), which simply reformats it as lines of 72 chars. (i also use it in development of these things as it tells me how many chars i'm at, and how many over 4 lines i am etc etc). al
Considered by teamster_jr: I was thinking of moving this to mediations as an explanation of obfuscation. is it worth it?
In Section
Obfuscated Code
|
|