/wordle-solver

Primary LanguageJavaScriptMIT LicenseMIT

wordle-solver

Usage

###########################################################################
## Command form: npm run start en c???? has=a,r not=t,i unknown=?a???,??a??
###########################################################################

# en                  - supported languages: en|bg
# c????               - pattern + length, ? denoting unknown letter
# has=a,r             - alphabet, known letters, unknown position
# not=t,i             - letters that aren't in the word
# unknown=?a???,??a?? - known letters but not possible positions

npm run start c???? has=a,r not=t,i, unknown=?a???,??a??

# output:

Your input:
lang: en
pattern: c????
letters: a,r
ignore: t,i

Devised patterns:
concreteLetters: /c[a-z][a-z][a-z][a-z]/gim
randomPlaceLetters: /(?=.*a)(?=.*r).*/gim
ignoredLetters: /((?![t,i]).)*$/gim

### Scoring 1:
┌─────────┬─────────┬────┬────────┐
│ (index) │    012
├─────────┼─────────┼────┼────────┤
0    │ 'ceral' │ 31189.94
1    │ 'clear' │ 31189.94
2    │ 'ceras' │ 30191.19
3    │ 'coran' │ 30175.51
4    │ 'cread' │ 30179.21
5    │ 'creak' │ 30167.57
6    │ 'cream' │ 30177.32
7    │ 'creda' │ 30179.21
8    │ 'crena' │ 30195.88
9    │ 'croak' │ 30147.2
10    │ 'crosa' │ 30170.82
11    │ 'copra' │ 29157.73
12    │ 'corah' │ 29156.9
13    │ 'coroa' │ 28178.1
14    │ 'crcao' │ 28164.72
└─────────┴─────────┴────┴────────┘
### Scoring 2:
┌─────────┬─────────┬────┬────────┐
│ (index) │    012
├─────────┼─────────┼────┼────────┤
0    │ 'crena' │ 30195.88
1    │ 'ceras' │ 30191.19
2    │ 'ceral' │ 31189.94
3    │ 'clear' │ 31189.94
4    │ 'cread' │ 30179.21
5    │ 'creda' │ 30179.21
6    │ 'coroa' │ 28178.1
7    │ 'cream' │ 30177.32
8    │ 'coran' │ 30175.51
9    │ 'crosa' │ 30170.82
10    │ 'creak' │ 30167.57
11    │ 'crcao' │ 28164.72
12    │ 'crura' │ 23162.23
13    │ 'copra' │ 29157.73
14    │ 'corah' │ 29156.9
└─────────┴─────────┴────┴────────┘

In the output you will get a sorted by highest score list of tuples [word, score, score].

Heuristics for English language are taken from here.

For Bulgarian I am doing a simple count of how many times a letter repeats in the words list + using this one frequency based on wikipedia articles.