About

  • Created by Dennis Hellewegen in 2023 (for fun).
  • It runs on .NET 8 and Blazor.
  • Algorithm based on the explanation provided in this video.

How to play

  1. Pick an English word.
  2. Click on the button with the amount of letters that your word has.
  3. The executioner will start guessing letters.
  4. If the guessed letter is in your word, click on the boxes where the letter would go.
  5. If the guessed letter is not in your word, just click 'Wrong guess'.
  6. If all letters have been guessed, verify by clicking 'That's my word!'. You lose!
  7. If the executioner guesses a wrong letter 6 times, the hangman is complete. You win!

How to win (without cheating)

  • The executioner is pretty good at finding words. Your best bet is to pick small words (3-5 letters).
  • The longer the word, the more unique it is and thus the easier it is to find.
  • The best words to win with are those that have a lot of one-letter variations.
  • For example, the word 'bat' is only one letter different from cat, fat, hat, mat, pat, rat, sat, and vat.
  • The executioner will probaby find '-at', but at that point all he can do is guess one or a few of those options and hope he picks the right one.
  • This is your best chance at winning.

How to win (with cheating)

  • You can also win by cheating.
  • This works when playing the game in the real world too, but only if you don't have to write down your word beforehand.
  • Start with the same strategy as above.
  • If the executioner picks the final letter of your word, choose one of the one-letter variations that he didn't guess the letter for yet and pretend that that word always was your answer.
  • Repeat the above until you've won. Well done, you filthy cheater.

Algorithm description

  • Create a list named 'possible words' and add all words with the correct amount of letters.
  • Create a list named 'unguessed letters' and add all letters in the alphabet.
  • Repeat until all letters have been found (we found the word and won) or there have been six wrong guesses (we lost):
    1. For every guess after the first one, remove all words from the possible words list that are no longer possible due to the previous guess.
    2. If the possible words list is now empty, we don't know the word and have lost (or the word is invalid).
    3. Determine which letter from the unguessed letters list appears in the highest amount of words in the possible words list.
    4. Remove this letter from the unguessed letter list.
    5. Guess this letter.
  • Additionally, when the possible word list becomes empty, we first ask a words API for additional possibilities.
  • If the API returns new words, we save those words for later, add the new words to the possible words list, and keep going with the algorithm.
  • If not, we admit defeat.
  • The idea behind guessing the letter that occurs in the highest amount of words is that one of these two things happens:
    1. correctly guess a letter.
    2. remove the highest amount of words from the possible words list.
  • Both options get us closer to the actual word (if we know it).
  • As new words get added, this algorithm will include these in its subsequent calculations.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙