For more than 60 days, about the first thing I do is to (try to) solve the Wordle puzzle (Wordle - The New York Times). For the very first days I did that manually, but then wrote a solver (i.e. a cheater) instead. The hardest part of this was to find a good enough sorting principle of the possible words (the candidates) and a good first guess word. After quite a lot of experiments I found something that is fairly good; right now this solver have an average of about 3.6 (of possible 6), and no misses.
Today I wrote a solver in SWI-Prolog: http://hakank.org/swi_prolog/wordle.pl .
The interface to the solver is as follows:
wordle(Words,CorrectPos,CorrectChar,NotInWord)
- Words: the wordlist/candidates
- CorrectPos: correct character in correct position,
Example: n is in position 4 and t is in position 5: "...nt":
- CorrectChar: correct character but in wrong position.
Example: a is not in position 1, l is not in position 2: ["a","l","","",""]
- NotInWord: characters not in word.
Example: s, a, and l are not in the word: "sal"
Here is an example:
wordle(".r.n.",["","","","",""],"slatcoe").
Given a certain wordlist, it yield the following candidates, sorted according to the scoring principle:
candidates=[briny,brink,grind,bring,drink,drunk,wring,wrung]
len=8
suggestion=briny
Perhaps this is useful for some…