7
Write a program that either accepts input via stdin or from the command line. It will then unscramble the words, printing out the unscrambled version of each word.You get a text file containing every word (most of them) in the English dictionary to use. (Here is the file: Word List, and you can either use it from the web or save it as a text file and use it from there.)
Inputs to measure the score:
bbuleb lwrfoe kaec rtawe cokr kmli pcaee
Correct Outputs:
bubble flower cake water rock milk peace
bubble fowler cake water cork milk peace
(Word case doesn't matter, and please post your score and outputs along with your code!)
Scoring:
Score = (Amount of correct outputs) x (100 / (Code Length))
The code with the highest score wins!
Edit: This is my first post, please be kind!
Scoring is suboptimal.
say 'bubble flower cake water rock milk peace'
scores hard-to-beat 213 and yet isn't very interesting. – J B – 2012-03-13T10:17:14.1936Many scrambles have multiple correct unscrambles...I mean "opst" could easily be "stop" or "pots" or "post" or "tops". – dmckee --- ex-moderator kitten – 2012-03-13T14:01:16.527
1I notice that all answers so far have loaded the wordlist from the web. Is there any requirement that the file cannot be local? – Steven Rumbalski – 2012-03-13T19:36:48.597
@StevenRumbalski No, you can either use it from the web or locally. – 3aw5TZetdf – 2012-03-13T20:29:45.223
I want to repeat dmckee's question: "bbuleb lwrfoe kaec rtawe cokr kmli pcaee" can be decoded as: bubble fowler cake water cork milk peace. Is this be considered correct output? If it isn't, it seems that some hard-coding of the requirements into my program would be needed. – Steven Rumbalski – 2012-03-13T21:04:12.997
You state that "Word case doesn't matter", does that mean that we can assume our inputs are in the same case as the word file (because currently they aren't). – Steven Rumbalski – 2012-03-13T21:11:45.780
1@StevenRumbalski fowler and cork is considered correct output and the inputs can be the same case as the word life. (Will edit the post about the correct outputs) – 3aw5TZetdf – 2012-03-14T01:17:12.373
If the word source is avaliable, why (Amount of correct outputs) in score? – l4m2 – 2018-05-04T02:09:57.260