Here's a version run through Perltidy - not too hard to understand if you know Perl regular expressions. The $c is the secret, $_ is the guess, and the code depends on matching the guess concatenated with the secret. Interesting code, and not a bad example of Perl really - it's just that the traditional scrunched-up formatting makes it look like line noise. I also made some minor changes for understandability/legibility.
Of course, I realise this is entirely against the idea of obfuscated code :)
#!/usr/bin/perl -l
$c .= 1 + int rand 6 for 1 .. 4; # Build up the secret
while (<>) {
/^\d{4}$|!/ || next; # Check user entered 4 digits
$_ .= $c;
1 while s!(.)(.{4})\1!?$2*!s; # Match in right position
1 while s!(\d)(.*\n.*)\1!+$2!; # Match somewhere
print /[*+]/g; # Print matches
/\*{4}|!/ && exit;
}
| [reply] [d/l] |