views:

314

answers:

2

Anybody care to translate this into obfuscated perl? It's written in Python taken from: here

def r(a):i=a.find('0');~i or exit(a);[m
in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for
j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18]
from sys import*;r(argv[1])

I realize it's just for fun :)

+2  A: 

There already are a few Sudoku solvers written in Obfuscated Perl, do you really want another (possibly less efficient) one?

If not...

  1. De-obfuscate.
  2. Rewrite in Perl.
  3. Obfuscate.
grawity
+3  A: 
sub r{($a=shift)=~/0/g?my$i=pos:die$a;T:for$m(1..9){($i-$_)%9*(int($i/9)^int($_/9))*(int($i/27)^int($_/27)|int($i%9/3)^int($_%9/3))||$a=~/^.{$_}$m/&&next T,for 0..80;substr($a,$i,1)=$m;r($a)}}r@ARGV

The braindead translation. Longer, since Python 2's / is integer division while Perl's is floating-point.

ephemient