Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Golf: Movie style code cracker.

by blokhead (Monsignor)
on Sep 12, 2008 at 19:24 UTC ( [id://710986]=note: print w/replies, xml ) Need Help??


in reply to Golf: Movie style code cracker.

Fun. Here's my interpretation of what a scrolling hacker toy would look like... It's 90 characters.
$n=pop;for(;;){warn$f,map(int rand 10,1..$n),$/;++$i%1e3 or$f.=int ran +d 10 and$n--or last}

You could make it run for >2.5 minutes by ...

replacing 1e3 with something like 1e8, presumably

Update: Here is another one that fills in the fixed positions not left-to-right, but randomly, to look more Matrix-like. As it gets more and more characters fixed, it slows down to increase the drama (this is me trying to sell a design inefficiency as a feature). It's 124 characters.

@x=("%d")x($n=pop);$"="";for(;;){printf"@x\n",map(int rand 10,1..$n);+ ++$i%500 or$n-=$x[rand@x]=~s/../int rand 10/e or last;}

On my machine, it looks nice doing 20-digit combinations.

blokhead

Replies are listed 'Best First'.
Re^2: Golf: Movie style code cracker.
by repellent (Priest) on Sep 14, 2008 at 01:47 UTC
    You're not matching the randomly chosen code C. On your way to decipher C, you would have likely iterated through the "correct" left-digits of C a few times before "locking" in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://710986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found