Optimal Algorithm for Winning Hangman

后端 未结 7 1383
庸人自扰
庸人自扰 2021-02-04 03:18

In the game Hangman, is it the case that a greedy letter-frequency algorithm is equivalent to a best-chance-of-winning algorithm?

Is there ever a case where it\'s worth

7条回答
  •  遇见更好的自我
    2021-02-04 04:11

    Assume the following dictionary: ABC ABD AEF EGH. (I'll capitalize unguessed letters.)
    Assume you have only 1 life (makes the proof so much easier...).

    The algorithm proposed above:

    Starting with A, you lose (1/4) or are left with aBC aBD aEF (3/4).
    Now guess B and lose (1/3) or are left with abC abD (2/3).
    Now guess C or D and you lose (1/2) or win (1/2).
    Probability to win: 3/4 * 2/3 * 1/2 = 1/4.

    Now try something else:

    Starting with E, you lose (1/2) or are left with AeF eGH (1/2).
    Now you know what to guess and win.
    Probability to win: 1/2.

    Clearly the proposed algorithm is not optimal.

提交回复
热议问题