in reply to Golf: Movie style code cracker.
108 characters:
Update: Adopted the required counting method, thus I have 108 characters, not 103.
Update 2: New version with 71 characters (however it would be a few (about 4) characters more if I hadn't copied a trick from BrowserUk; I'll elaborate in the spoiler tag):
Caveat: The second version will probably not terminate for a 1-digit code.
Update 3: :-( I just noticed that my 71 character solution has the problem that it always prints "8" as the last digit. For the moment, I offer the following fix, which makes it 75 characters long (and I'll omit the spoiler tags as the contest seems to be over):
-l15e'print|substr$_||=1x($l=pop),~rand$l,1,~~rand 10 while++$A%1e6||- +-$l'
(And you can modify the 1e6 constant to shorten the runtime.)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Golf: Movie style code cracker. (Updated)
by BrowserUk (Patriarch) on Sep 15, 2008 at 02:37 UTC | |
by betterworld (Curate) on Sep 15, 2008 at 03:15 UTC | |
by ambrus (Abbot) on Sep 15, 2008 at 06:21 UTC | |
by BrowserUk (Patriarch) on Sep 15, 2008 at 06:46 UTC |
In Section
Meditations