I should add:

(1) If you do not have a /usr/share/dict/words, you can google for
that and find plenty of examples.

(2) There's also a wordle specific words list -- you can just pull it
out of the javascript for the page, like greg heil mentioned (and
since those are in sequential order, solving one wordle would give you
the next day's wordle solution also -- but where's the fun in that?).
Or, you could use something like
https://gist.github.com/cfreshman/a03ef2cba789d8cf00c08f767e0fad7b

(3) I could have done a better job of picking a next guess. But I
haven't thought through enough about the entropy associated with the
possibilities. Conceptually, each guess creates a partition on the
possible answers and we probably want to minimize the size of the
largest element of that partition.  The largest partition is probably
going to be the partition with the maximum number of grey letters (or
maybe with one yellow letter). But just guessing arbitrarily seems to
work.

That said, this might be a better guesser:

goodGuess=: {{
  abc=. /:~~.,y
  weights=.+/(abc i.|:y) {"1 #/."1~abc,"1|:y
  y{~ (0,+/\weights) I. ?+/weights
}}

Basically, goodGuess would replace ({~ ?@#) and it tends to favor
words with commonly occurring letters.

Thanks,

--
Raul


On Mon, Jan 24, 2022 at 10:38 AM Raul Miller <[email protected]> wrote:
>
> 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

Reply via email to