Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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.

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found