The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
varianceexplained.org
The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
1–10 of 12 posts
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#2I made a little clone of the game to get around these restrictions[1].
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#3I used the “hard copy” rule set as used in the printed New York Times, which is slightly different from the web rule set: words must be at least five letters long, not four, and are worth 1 point each, or 3 for a pangram. The hard copy puzzles also include three score thresholds, so I had a bit of fun trying to reverse-engineer how those thresholds are chosen. I didn’t get exactly the right function, but I got fairly close, and most importantly the thresholds feel fair when playing. (The online version also has score thresholds, but there are many more of them, and it was easy for me to transcribe thresholds from the archives of the printed copies.)
In my admittedly biased yet assuredly humble opinion, both the algorithm performance and the rating threshold estimation are interesting: https://github.com/wchargin/spelling-bee/tree/master#perform...
Oh, and a web-based solver, for convenience: https://wchargin.github.io/spelling-bee/
Lovely to see how the author of this article and I both had a lot of fun with this by taking it in different directions. :-)
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#4I was also able to get to about a 2 second solution, but I didn't have to do bit operations: https://nbviewer.jupyter.org/github/norvig/pytudes/blob/mast...
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#5https://github.com/ncm/nytm-spelling-bee/
I did both C++ and Rust versions. They run in the same time. My goal was the fastest single-threaded program that would fit on exactly one printed page. My first version ran in about a second, and I spent months shaving off milliseconds. Rust in 2016 was much more sensitive to arbitrary details of the source code. Maybe it's better now.
The final version does enough setup to enable most of the time to be spent in a four-instruction loop that a modern core can do in a single cycle per iteration, with occasional detours.
Compilers (clang is especially insistent) prefer to arrange the loop to take two cycles, and save a cycle on the long detours instead. I filed a bug on Gcc over it preferring the slow loop, but they decided the slow version was better:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=67153
I absolutely recommend spending months optimizing a little but complicated program. I learned so much. Most things you think will make it faster make it slower.
The solution to any such puzzle is an easy one-line shellscript, also on the github page.
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#6Hey, I wrote one of these, too! Mine generates and solves all possible puzzles (with my dictionary, there are 54733) in about 1.8 seconds on my six-year-old laptop, and can also typeset them to LaTeX+TikZ to make printable puzzle sheets. That’s 0.03 milliseconds per puzzle. It turns out that you can get this thing to run quite fast once you realize that you can pack words into bitsets and express the whole algorithm…
Anyway, whenever I see a problem that involves letters now, I reach for bit operators first.
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#7I don't understand. Why S?
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#8>it must not contain the letter S (that would be too easy) I don't understand. Why S?
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#9>it must not contain the letter S (that would be too easy) I don't understand. Why S?
If the puzzle contains S it will be very easy to form plurals and therefore run up the score.
If you run Robinson's code but omit the filtering out of words with S, the best puzzle is E/AINRST (8681 points). The previous winner, R/AEGINT at 3898 points, is now only 442nd-best. (Notation: I put the required center letter before a slash.)
Interestingly, one of the five puzzles that's tied for 15 points, the second-worst possible, includes an S. The puzzle is Q/CIORSU - the words are CROQUIS and SUQS.
Re: The 'Spelling Bee Honeycomb' puzzle: efficient computation in R
#10The words are revealed the next day on the puzzle page, or if you're impatient, they are in the source code for the Spelling Bee page each day.