M2M Day 259: I built a less exciting version of Hangman

This post is part of Month to Master, a 12-month accelerated learning project. For July, my goal is to solve a Saturday New York Times crossword puzzle in one sitting without any aid.

Yesterday, I described the Expanding & Contracting (E&C) method for pushing a “stuck” crossword puzzle forward. The technique uses low-probability guesses, specifically related to letter frequencies and statistics.

For example, if I know a particular six-letter answer is I _ O N I _ , would I be able to guess, just based on word shape and my knowledge of the English language, that the last letter is most likely a C, giving me I _ O N I C, and then subsequently guess that the second letter is also a C, giving me ICONIC?

This ability to build out answers, not based on clues, but based on likely letter patterns is an ability I want to cultivate further (as it’s foundational to the E&C technique and how I plan to level up my crossword-solving abilities).

By nature of solving puzzles for the last two weeks, I’ve already started developing a reasonable mental representation of common letter patterns, but I haven’t trained this ability in any deliberate or focused fashion.

Thus, to do so, I built a new computer program called the “Letter Trainer”.

Here’s how it works…

  1. First, an answer is displayed to me with one letter replaced by a question mark (i.e. I?ONIC).
  2. In my head, I try to guess what the letter is.
  3. If I click the Enter key, the clue which corresponds to the answer is shown (i.e. “Quintessential”)
  4. In my head, based on this clue, I update my guess. Sometimes, if the clue is suggestive of a foreign language, a name, etc., my guess will change to incorporate this new information.
  5. If I click the Enter key again, the answer is shown in it’s entirety (i.e. ICONIC).
  6. In my head, I make a note of whether or not I answered correctly, subconsciously tweaking my mental model of letter patterns.
  7. If I click the Enter key again, an explanation of the answer is shown (just in case I don’t know what the answer means, and want to learn about it).
  8. If I click the Enter key one last time, the process starts over with a new answer.

The program is simple, only 25 lines of code, but gets the job done…

import csv
from random import randint
clues = []
with open('crossworddata.csv','rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
clues.append(row)

length = len(clues)
while True:
randNumber = randint(0,length)
randWord = clues[randNumber][1]
randAnswer = randWord.replace(" ", "").replace("-", "").replace("'", "").replace("!", "")

lenRandAnswer = len(randAnswer)
randLetter = randint(0,lenRandAnswer-1)

answerList = list(randAnswer)
answerList[randLetter]='?'

output = "".join(answerList)
print output
raw_input()
print clues[randNumber][0]
raw_input()
print clues[randNumber][1]
raw_input()
print clues[randNumber][2]
raw_input()

To use the program, I can run it in Terminal, which looks like this…

I’ve considered a few other variations of this program (multiple question marks per answer, two answers intersecting at a question mark, etc.), but this most simplified version seems to be sufficient for now.

Tomorrow, during my commute, rather than training with the Crossword Trainer, I will train with this newly-created Letter Trainer and see how it goes.

I’m optimistic that it will help.

Read the next post. Read the previous post.

Max Deutsch is an obsessive learner, product builder, guinea pig for Month to Master, and founder at Openmind.

If you want to follow along with Max’s year-long accelerated learning project, make sure to follow this Medium account.