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 !.
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
./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.
- 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.