One issue here is the wordle word list.
For example, 'peasy' is an english word, but wordle will not give any
information about matching letters if you try that word. Since wordle
only uses about a quarter of the english language five letter words,
this is a significant constraint. Fortunately, though, wordle will let
you backspace over any such attempt so those do not count against your
guess count.
Anyways, it's possible to provide a cleaner user interface here, but this works:
fives=: ~.(#~ ] -:"1 tolower"1)>(#~ 5=#@>) <;._2 fread '/usr/share/dict/words'
wordle=: {{
possible=. fives
for_try.y do.
'guess match'=. try
possible=. possible #~ (guess="1 possible)*/ .= match=2
t=. (guess e."1 possible)="1 match =1
t=. t+.(guess="1 possible)*"1 match=2
t=. t*(guess ="1 possible)="1 match=2
possible=. possible #~ */"1 t
end.
echo #possible
echo 'try ',({~ ?@#) possible
}}
If you do
wordle ''
It will pick a random possible word.
You then need to construct an argument which represents that word and
a five number list with 0 for grey, 1 for yellow and 2 for green for
each character in that letter.
So, successive tries would look like:
wordle ,:'guess';abcde
wordle ('fghij';klmno),:'guess';abcde
wordle ('pqrst';wxyzA),('fghij';klmno),:'guess';abcde
...
--
Raul
On Mon, Jan 24, 2022 at 9:09 AM bill lam <[email protected]> wrote:
>
> The game wordle in the website.
>
> https://www.powerlanguage.co.uk/wordle/
>
> Any idea of how to generate a list of candidates words after new
> information from each row?
>
> Eg,
>
> T H I E F # all wrong
> R A D O N # O and N are there but misplaced
>
> what is the list of words for the 3rd row?
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm