Letterpress is a word game. I wrote a solver for it, called LetterPwn.
Try it out by hitting the ‘random board’ button. It creates a random board, makes an API request to the server, and shows you the best
possible moves for the blue player at right.
It will probably do this in a fraction of a second, even if there are tens of thousands of possible moves to
consider. You can pop open the “stats” link beneath the recommended words to see how much work it’s doing.
Hover over the suggested words to see the moves highlighted. Try using the tools at the bottom of the board to change letters, or
simulate an ongoing game where red and blue already control some of the board, to see what LetterPwn recommends as the next move for blue.
Also try the Vocabulary slider at the top right.
One of my favorite things is to create what seems like an overwhelming position for red, and then see how
LetterPwn usually manages to gain the upper hand, or at least ruin the red player’s strategy.
I didn’t do this just to ruin Letterpress forever, or join the ranks of Letterpress cheater apps.
It was an experiment to teach myself Node.JS. I couldn’t
decide if I loved this framework or hated it. It had so many virtues, but it has so many quirks. Curiously, people often advise
you not to try… computing… in this computer language.
So I decided to sail straight into the winds, and try to develop a computation-heavy service in Node, just to see
how bad it would be. It turned out to be very educational. I’ve split this into two parts.
In Part I, (this document), I’ll discuss LetterPwn’s algorithm for picking
In Part II, I discuss the programming strategies to make this service quick and responsive to many users at once.
A standard Node.JS server is single-threaded, and might be stuck for many seconds serving a single user.