3 ms·
You could write a bot to minimize the worst-case number of guesses by using a minimax-style tree search with a zero-sum two-player perfect-information version o
by bumbledraven 5y ago
You could write a bot to minimize the worst-case number of guesses by using a minimax-style tree search with a zero-sum two-player perfect-information version of the game. Here's how that could work.
There are two players, Guesser and Responder, who share a dictionary of words. Responder starts the game by stating a positive integer N, where there is at least one word of length N in the dictionary. The turns then alternate between Guesser and Responder. Guesser proposes any dictionary word of length N, and Responder then provides feedback on each letter in the word (i.e., right letter in wrong place, right letter in right place, wrong letter) such that at least one N-letter word in the dictionary is consistent with all the feedback given so far.
The game ends when Responder indicates that Guesser's word is correct in all places, or after responder has provided feedback 6 times, whichever comes first. If Guesser never guessed the word, Responder gains 7 points. Otherwise, responder gains a number of points equal to the number of turns taken by Guesser.
Alternatively, the bot could minimize the expected number of turns using an expectimax (https://en.wikipedia.org/wiki/Expectiminimax https://en.wikipedia.org/wiki/Expectiminimax) search, under the assumption that the hidden word was chosen uniformly at random from the set of all dictionary words of the same length.