/spelling-bee-master

A simple Python solution to NYT's spelling bee.

Primary LanguagePythonMIT LicenseMIT

Spelling Bee Master

A number of Python solutions (1, 2, 3, 4) have been proposed for the Spelling Bee problem. The one that we propose here aims at being the simplest and most naive solution. It will probably be the slowest and numbest, but it provides a generous amount of candidate words, among which the user will have to pick the ones that are not geographical terms or personal names.

The rationale

  • Download the english vocabulary from here.
  • Transform the vocabulary into a dictionary that associates each letter to the set of words that contain that letter.
  • From the struct, pick the set of the words that contain the mandatory letter.
  • Go through each of these words and keep only those that are made with letters in the admissible dictionary.

How to use

  • Set the mandatory (central) letter, e.g., mandatory = 'u'.
  • Set the six optional letters in a set, e.g., optional = {'t', 'e', 'c', 'a', 'o', 'r'}.
  • Run the script.
  • Read the printed words.

Requirements

  • Python 3

Acknowledgements

Thanks to the people that maintain the english words database.