All this week, I've been trying to chip away at Allen R. Morgan's "Twice Removed" puzzle on page 50 of the August 5, 2012 New York Times Magazine. The rules:
For each word below, add the same pair of letters *twice*
to complete a longer word. For example, if you were given
MOTE, you would add ON twice to make MONOTONE.
After a few days, I'd found just four of the 24 words. Pathetic. After moping for a bit, I tried brute-forcing the answers. The strategy was simple, but radically different from how you or I would try solving the puzzle by hand. The steps:
-
Get a big list of English words.
-
Select all the words with four more letters than the length of the starting words. E.g., eight-letter words if we're starting with four-letter words.
-
Select the subset of the words from Step 2 that include doubled letter-pairs. In code, this meant words that match this regular expression:
/(..).+(\1)/
-
For each of the words from Step 3, subtract the matching letter-pairs.
-
For each of the words from Step 4, see if the shorter version is a real English word — or one of the puzzle's starting words.
The mini-program, written in Ruby, is below. I'm a Ruby novice and wrote the script in haste, so there's plenty of room for improvement. (If you have a better version, send it to me and I'll merge it.)
So, did it work? Pretty much. Using the "12dicts" word list (specifically, the "2of12inf" sublist), the program found 12 of the 14 main four-letter starting words. It even found that two of those words had multiple answers: rise leads to both porpoise and tortoise; and cant leads to both decadent and recreant.
(The answers to two of the 24 starting words, calm and alter, are supposed to lead to "common two-word phrases". I'm leaving these out.)
The program solved only half of five-letter words, but aced the single six-letter and eight-letter words. The full results are below.
BONUS: The program also uncovered some starting words the puzzle didn't use. Try your hand at these:
- cafe
- veer
- nest
- male
- unit
- tong
I like your brute force method: I had been trying to craft a regular expression to run against a dictionary file but ended up getting stymied. I'll have to see if I can dust it off and make it work...