https://github.com/azdavis/wordle-best
The best starting Wordle word?
https://github.com/azdavis/wordle-best
Last synced: about 2 months ago
JSON representation
The best starting Wordle word?
- Host: GitHub
- URL: https://github.com/azdavis/wordle-best
- Owner: azdavis
- Created: 2022-01-23T22:59:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-24T00:22:05.000Z (over 3 years ago)
- Last Synced: 2025-01-28T03:29:26.661Z (4 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# wordle-best
An attempt to find the best starting [Wordle][1] guess.
## The answer
Apparently it's "aries".
## Methodology
A guess G is "better" than a guess G' if, given all possible answer words A,
there are fewer words that might be the answer given the information gained from
the guess G on the answer word A than G'.So, we find the best guess by naively O(n^3) looping over all guess words and
all answer words, then, for each pair, finding the number of words that might
possibly be the answer given this guess-answer pair.Then we sum over all the the answer words for each guess and return the answer
word with the minimum overall sum.## Running the code
Clone the repo and download a dictionary of words (one word per line) to
`src/words_alpha.txt`. I got one from [here][2]. (I ignored it in the git repo
since the file size is large.) The program automatically filters for length-5
words.Then just
```sh
$ cargo run --release
```On my machine it runs at about 1 iter/sec and there are 15918 words, so it'll
take about 4.5 hours.Scratch that, this is embarrassingly parallel, so I added rayon to speed it up.
With some combination of `par_iter` and regular `iter`, I'm now able to get
about 6.4 iter/sec on my machine.Notes:
- I think I need to make the outermost iterator non-parallel to make `progress`
work.
- Interestingly making both inner loops `par_iter` gave me about 5.8 iter/sec.
Maybe because the overhead from making stuff parallel wasn't actually worth.[1]: https://www.powerlanguage.co.uk/wordle/
[2]:
https://github.com/dwyl/english-words/blob/22d7c41119076750a96fca2acd664ed994cc0a75/words_alpha.txt