title: The perverse hangman problem
body: <p>Perverse Hangman is a game played much like regular Hangman with one important difference: The winning word is determined dynamically by the house depending on what letters have been guessed.</p>
  
  <p>For example, say you have the board <strong>_ A I L</strong> and 12 remaining guesses. Because there are 13 different words ending in AIL (bail, fail, hail, jail, kail, mail, nail, pail, rail, sail, tail, vail, wail) the house is guaranteed to win because no matter what 12 letters you guess, the house will claim the chosen word was the one you didn't guess. However, if the board was <strong>_ I L M</strong>, you have cornered the house as FILM is the only word that ends in ILM.</p>
  
  <p>The challenge is: Given a dictionary, a word length &amp; the number of allowed guesses, come up with an algorithm that either:</p>
  
  <p>a) proves that the player always wins by outputting a decision tree for the player that corners the house no matter what</p>
  
  <p>b) proves the house always wins by outputting a decision tree for the house that allows the house to escape no matter what.</p>
  
  <p>As a toy example, consider the dictionary:</p>
  
  <pre><code>bat
  bar
  car
  </code></pre>
  
  <p>If you are allowed 3 wrong guesses, the player wins with the following tree:</p>
  
  <pre><code>Guess B
  NO -&gt; Guess C, Guess A, Guess R, WIN
  YES-&gt; Guess T
        NO -&gt; Guess A, Guess R, WIN
        YES-&gt; Guess A, WIN
  </code></pre>