|P is for Practical|
Golf: Movie style code cracker.by BrowserUk (Pope)
|on Sep 12, 2008 at 15:10 UTC||Need Help??|
You see it in the movies all the time. The good/bad guy plugs a (large or small, depending upon the age of the movie), device into the safe/door lock/ATM/whatever and the LCD/LED/NIXIE tube display rolls through the 6/8/10 digit password/pin blurringly fast and, one by one, the digits become static as the device 'cracks' the code.
So, supplied with a command line argument, D, indicating the number of (numeric) digits, code a routine that picks (fairly) a random code, C, in the range 0 .. 1eD -1, and then scrolls the display (sequentially or randomly), until the first digit (left most) matches the first digit of C. Then scrolls the remaining digits until second digit matches the second digit of C; and so on until the randomly selected code is completely matched.
Rules: every character used, including command line (excepting "perl" and any preceding path), but including all switches and other CLI syntax; and every character of any non-pre-existing (as of midnight 11th September 2008) CPAN/core modules. Lowest character count wins.
(+10 for any solution that runs more than 2.5 minutes (average time for a 'tense' movie scene (guestimate:)), for a 10 digit code.)
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.