UPDATE 9/21/2009
Wow. this is a real reminder of how easy it is to fall prey to your own certainty. I tested my script on a couple of cases, and they turned out fine, so I assumed that all was well. I tried a new case and found that "something" was wrong. I fixed that something and was happy. I never bothered to test any other cases until later. OOPS! I have been running several cases after making my final adjustments. I believe that NOW the script solves all problems it's designed too. I AM crossing my fingers on this, but it looks like I've repaired all my bits. (pun absolutely intended- also a hint) Well, not quite. There is one case that it does solve, & I don't know why that is... maybe someday I'll get it. As it is, I'm putting adjusted code in a less obfuscated manner bacause I'm a tad too lazy to worry about it...Big UPDATE:
I left out a key peice of code in the obfuscation. The output was incorrect for the lack of that code. Now that it's in there, all problems of the sort that this code solves should be solved unless I hade any other errors in logic *sigh* Of course, if you have the non-corrected code, you might gain some insight from comparing the two versions. I have#!/usr/bin/perl use integer; my $field ='8000401030005007001300000000002060805000000040204070000000 +00031002004000604070005'; $field =~s/[^\d]//g; $field =~s/(\d)/$1,/g; $field =~s/([1-9]),/(2**($1-1)).","/eg; my %h; for (1..9){$h{2**($_-1)}=$_}$h{0} = "-"; my $old = 'init'; my $new = ' 2nd init'; while ($old ne $new){ $new = ''; my $z = 0; for my $i (0..80){ my ($cell) = $field =~ /(?:\d+?,){$i}(\d+)/; my $b=($i/27)*27+3*(($i%9)/3); my $c =($i%9); my $r = ($i/9)*9; if ((!($cell))or($cell & ($cell - 1))){ $field =~ s/((?:\d+?,){$i})(\d+)/$1$z/; my $hb; map{$hb.=$_}map{/(\d+,\d+,\d+,)(?:\d+,){6}(\d+,\d+,\d+,)(? +:\d+,){6}(\d+,\d+,\d+,)/}$field=~/(?:\d+,){$b}(.*)/; my $hc; map{$hc.=$_}map{/(?:\d+,){$c}(\d+,)(?:\d+,){8}(\d+,)(?:\d+ +,){8}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8}(\d+,)(?:\d+, +){8}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8}(\d+,)/}$field=~/(.*)/; my $hr; map{$hr.=$_}map{/((?:\d+,){9})/}$field=~/(?:\d+,){$r}(.*)/ +; my $ha = $hr.$hc.$hb; my $nset = 511; map{($_ & ($_ - 1))?():($nset = ($nset & (511 ^ $_)))}$ha +=~/(\d+),/g; my $oset = 511; map{$oset = ($oset & (511 ^ $_))}$hr=~/(\d+),/g; ((!($oset & ($oset - 1)))and ($oset))?($nset = $oset):(); $oset = 511; map{$oset = ($oset & (511 ^ $_))}$hc=~/(\d+),/g; ((!($oset & ($oset - 1)))and ($oset))?($nset = $oset):(); $oset = 511; map{$oset = ($oset & (511 ^ $_))}$hb=~/(\d+),/g; ((!($oset & ($oset - 1)))and ($oset))?($nset = $oset):(); $field =~ s/((?:\d+?,){$i})(\d+)/$1$cell/; $cell = $nset; } $new .= "$cell,"; } $old = $field; $field = $new; } print "$field\n";
#!/usr/bin/perl use integer;use bigint;my $f = 815339036749889258964663919539108863582 +51535807693868444296494056897195949107537 + (2**266);$f =~s/(\d)/$1,/ +g;$f =~s/([1-9]),/(2**($1-1)).","/eg;my $scratch = ' ';my $hctarcs;my + $a = sub{'(\d+,\d+,\d+,)(?:\d+,){6}'};while ($scratch ne $hctarcs){$ +hctarcs = ' ';for (0..80){my ($fantabulous) = $f =~ /(?:\d+,){$_}(\d+ +)/;my $b=($_/27)*27+3*(($_%9)/3);my $c =($_%9);my $r = ($_/9)*9;if (( +$fantabulous < 1) or ($fantabulous & ($fantabulous - 1))){ $f =~ s/(( +?:\d+?,){$i})(\d+)/$1$z/;my $hb;map{$hb.=$_}map{/(\d+,\d+,\d+,)(?:\d+ +,){6}(\d+,\d+,\d+,)(?:\d+,){6}(\d+,\d+,\d+,)/}$f=~/(?:\d+,){$b}(.*)/; +my $hc;map{$hc.=$_}map{/(?:\d+,){$c}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8 +}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8} +(\d+,)(?:\d+,){8}(\d+,)(?:\d+,){8}(\d+,)/}$f=~/(.*)/;my $hr;map{$hr.= +$_}map{/((?:\d+,){9})/}$f=~/(?:\d+,){$r}(.*)/;my $ha = $hr.$hc.$hb;my + $nset = 511;map{(($_ & ($_ - 1)) and ($_))?():($nset = ($nset & (511 + ^ $_)))}$ha =~/(\d+),/g;my $mmmm_nice_yummi_scrumptious_bagels = 511 +;map{$mmmm_nice_yummi_scrumptious_bagels = ($mmmm_nice_yummi_scrumpti +ous_bagels & ($mmmm_nice_yummi_scrumptious_bagels - 1))}$hr=~/(\d+),/ +g;($mmmm_nice_yummi_scrumptious_bagels & ($mmmm_nice_yummi_scrumptiou +s_bagels - 1))?($nset = $mmmm_nice_yummi_scrumptious_bagels):();$mmmm +_nice_yummi_scrumptious_bagels = 511;map{$mmmm_nice_yummi_scrumptious +_bagels = ($mmmm_nice_yummi_scrumptious_bagels & ($mmmm_nice_yummi_sc +rumptious_bagels - 1))}$hc=~/(\d+),/g;($mmmm_nice_yummi_scrumptious_b +agels & ($mmmm_nice_yummi_scrumptious_bagels - 1))?($nset = $mmmm_nic +e_yummi_scrumptious_bagels):();$mmmm_nice_yummi_scrumptious_bagels = +511;map{$mmmm_nice_yummi_scrumptious_bagels = ($mmmm_nice_yummi_scrum +ptious_bagels & ($mmmm_nice_yummi_scrumptious_bagels - 1))}$hb=~/(\d+ +),/g;($mmmm_nice_yummi_scrumptious_bagels & ($mmmm_nice_yummi_scrumpt +ious_bagels - 1))?($nset = $mmmm_nice_yummi_scrumptious_bagels):();$f +antabulous = $nset;}$hctarcs .= "$fantabulous,";}$scratch = $f;$f = $ +hctarcs;}$f =~ s/(\d+),/$1/g;print "$f\n";
Back to
Obfuscated Code