Posts

Six guesses suffice in Wordle's hard mode

Recently  I posted some computer analysis of Wordle. That analysis applied to Wordle's normal (“easy”) mode. What about hard mode? Wordle's hard mode In normal play, Wordle allows any word in its dictionary to be used as a guess. But Wordle also allows you to select “hard mode”. In that mode, letters that have been revealed by the scores of earlier guesses must be used in later ones. For example, suppose I have already guessed TRACE: T R A CE (-+--/) Then that has revealed that the letters R, C, and E all appear, and that R is the second letter. In hard mode, every later guess must have all three letters and must have R in second place. So the guess PLIED from the earlier post would not be allowed. CREDO would be allowed, and so would CRATE, even though it couldn't be the solution (we know there is no A and we know that E is not the last letter). Computer analysis Hard mode is hard for computers as well as people, in that the methods I described before don't work as we

Solving Wordle

Everybody's playing  Wordle . It looks as if computers should be able to play it well. But how well? And what is the best first guess? The game If you have been living under a rock, or if you are from The Future when the Wordle fad has passed, here's a summary. It's a simple web page where you have to guess a hidden five-letter word. There's a different five-letter word every day, but on any given day it is the same word for everyone. So people can compare their success in guessing the word. To play, you enter a series of guesses as to what the word might be. Each guess has to be a real five-letter word. The game shows a score for each guess. If a letter in the guess is also in the hidden word, in the same position, then that letter is coloured green. If a letter is in the hidden word but in a different place, the letter is coloured yellow. Letters in the guess that are not in the hidden word are coloured grey. For example if the hidden word is CREEP and I guess TRACE t
Using the builder pattern with subclasses [Back when I worked for Sun Microsystems, I had an occasional blog. It survived the Great Absorption into Oracle for a while, but it now seems to have gone the way of all things. Here's an entry from it, fished out of the Internet Archive.] Josh Bloch's  Effective Java  popularized the  Builder Pattern  as a more palatable way of constructing objects than constructors or factory methods when there are potentially many constructor parameters. The formulation in Effective Java makes for a particularly readable construction, like this: new Rectangle.Builder().height(250).width(300).color(PINK).build(); The advantage over a constructor invocation like  new Rectangle(250, 300, PINK);  here is that you don't have to guess whether 250 is the height or the width. More generally, if the constructor allowed you to specify many other parameters — such as position, opacity, transforms, effects, and so on — it would quickly get very messy. The b