Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: 2008 Winter Scripting Games have begun

by xdg (Monsignor)
on Feb 18, 2008 at 18:01 UTC ( [id://668628]=note: print w/replies, xml ) Need Help??


in reply to Re^2: 2008 Winter Scripting Games have begun
in thread 2008 Winter Scripting Games have begun

Wow. Four lines is pretty lean. Is that four statements? Just prompting for a number and reading it back is two, plus printing the result is three and that doesn't count opening the word list file. Or do you mean that the algorithm parts rather than the housekeeping parts are four lines?

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

  • Comment on Re^3: 2008 Winter Scripting Games have begun

Replies are listed 'Best First'.
Re^4: 2008 Winter Scripting Games have begun
by Limbic~Region (Chancellor) on Feb 18, 2008 at 18:58 UTC
    xdg,
    Who said anything about opening the word list file?
    1. Obtain all possible solutions through nefarious means 2. Print a line asking for input 3. Get a phone number as input 4. Display the result
    Since I wasn't disqualified, I will wait until after the deadline for event 1 before revealing my solution.

    Cheers - L~R

      Well, the event description does have the following clause:

      In addition, the word must appear in the file WordList.txt

      That does sort of imply that even if you use nefarious means, you should be checking that a word from the 'nefarious' list is also in their WordList.

      Of course, maybe they won't catch that. ;-)

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

        xdg,
        Well, I calculated how many words were exactly 7 characters long and did not contain Q or Z. After removing duplicates (words that generated the same phone number), there were only 3818 entries. I precomputed all possible solutions and stuck them in __DATA__ so nefarious means =
        my %lookup = unpack("(A7A7)*", <DATA>);
        Provided they use the same wordlist.txt that was distributed in the kit, my solution is valid. Since I have been awarded 10 points, I assume they didn't really mean you have to point to 'C:\Scripts' when they run it.

        Cheers - L~R

Re^4: 2008 Winter Scripting Games have begun
by xdg (Monsignor) on Feb 18, 2008 at 18:28 UTC

    But it's a good challenge to think through. Though I ran it against my unix dictionary list, I was able to get it to 5 lines -- not counting strict and warnings. I could see how with a little "do" or "and" trickery or golfing, I could make it 4 or less, but it's not really the point, I guess. (E.g. "say 'Enter number' and my $num = <STDIN>") And as you said, it's very fast.

    Maybe I should enter after all.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

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

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

    No recent polls found