8
4
According to this page, the best strategy to guess English hangman words is to calculate the odds of each letter in a word list that meet our conditions. But, as I'm really lazy, I don't really want to compute every word in the dictionary by myself. But, as I know that you are always here to help me, I'm sure you will be able to make me some king of a code that will do that for me. And, because my hard disk is nearly full, I'd like the smallest possible code. It means that this is code-golf, and the submission with the lowest amount of bytes will win, but also the most accurate one !.
Input/Output
A random word from this wordlist will be taken.
Your program should accept, in arguments, or by user input (popups, stdin, whatever),
- Length of the word
- Incorrect letter already found, or 0 if we just started the game, and you provided no incorrect letter.
- Letters already found AND their position in the word
Example : ./hangsolver 6 XBZ 1P 4P 2E 6E
Here, I picked the word "people". For clarity : P E _ P _ E (Wrong letters are X B and Z)
That means, in one game, I'll have to launch your script many times!
The output will be a single letter, your next try.
Rules
- The one that will guess 10 words in less tries than the others will win.
- In case of a tie, shortest code in bytes win.
- If there is still a tie, the fastest program will win.
- You may assume that there are only these words in the English language
- I'll only try valid words from the wordlist.
- I've got a good computer, CPU power won't be a problem ( but try to answer as fast as you can !)
- You can't solve with an online solver, but you can download the wordlist, or have it passed as an argument. You can assume it will be named "wordlist.txt" and in the same directory as your script.
- Your code must be able to run on a common OS. It could be windows, mac, or ubuntu/debian/CentOS or Redhat.
- You can't use an external solver.
- You can however shorten the URL to the wordlist.
- This code-golf will end the first of September.
- You MUST use the method described above.
Good luck !
Wordlist found here on SE.
2Shortest code in bytes will win, with best guess being the tiebreak? That means that my program that simply guesses any random letter that hasn't been used before will beat someone elses that actually tries to work out a good guess. You may want to rethink your scoring, or you are going to get trivial answers. – Level River St – 2015-08-17T09:46:31.070
"You MUST use the method described above.", I quote the rules. But I'll edit to make that the primary winning criteria – WayToDoor – 2015-08-17T09:47:48.947
1To be clear, "using the method described above" means guess the letter that appears in the largest number of the possible words that has not been guessed yet? – isaacg – 2015-08-17T09:49:48.307
Yes, exactly. Thanks for the typo edit ! – WayToDoor – 2015-08-17T09:50:50.320
1Shouldn't the input data in your example be "6 XBZ 1P 4P 2E 6E"? – Razvan – 2015-08-17T10:44:39.420
Oh yeah, sorry. I'll edit. – WayToDoor – 2015-08-17T11:10:25.897
You're right. Edited – WayToDoor – 2015-08-17T20:42:45.933