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.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Golf: Movie style code cracker. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.