Helps out with the Wordle game
npm install
npm start
And it will output something like this:
[ 'CURIA', 'FAUNA', 'VACUA', 'VULVA' ]
based on the hardcoded requirements found here.
Consider the following static example:
It looks for words that:
- Must contain the letters
A
andU
in it. - Do not contain the following letters:
O, T, S, E, P, B
- And follow specific rules for specific positions:
- 1: Is not an
O
- 2: Any letter
- 3: Is not
T
,A
- 4: Is not
E
,L
- 5: Is an
A
- 1: Is not an
And it will order the list of results by the number of different letters present in the word.
Go to the requirements builder and change the hardcoded values, the next step is to setup a web server and expose an endpoint that expects the requirements in a json format.
It follows the steps:
- Loads the list of valid words (static/en-us.txt or static/pt-br.txt)
- Uses the words to create a search tree/graph structed that faciliates the matching of requirements later.
- Navigates the tree from root to leaf, checking if each next node satisfies the requirements, in case it gets to the leaf node (length 5) and all requirements are still met, it adds the word to the list of possible solutions.
- Sorts the result using some criteria that favors mistakes that will teach you more about the word.
- Returns/logs the list.