Time for this week's solution. Spoilers ahead!
Here's the Sunday Puzzle again:
This challenge comes from listener Gerry Reynolds of Chicago. Name a national landmark (6,3). Add the name of a chemical element. Rearrange all the letters to name two states. What are they?
As we discussed, (US) states is a closed set of 50, and elements are a closed set of 118. But we need a list of national landmarks, which is an open set. I suggested we start with Wikipedia for a list of landmarks.
Surprisingly, I didn't find what I wanted at Wikipedia. There are lists of landmarks by state, and national parks, etc., but nothing like a single big list of landmarks and tourist attractions.
I did some web searching instead and found a nice clean list of 200 national landmarks.
Given that we're dealing with three fairly small lists, I just hard coded the lists into my solver script (rather than storing them in files to be read by the script). As always, you can find the solver script on the companion GitHub repo for this blog. It's annotated with comments so it should be easy to follow. Basically, I simply followed the plan I laid out in the preview post:
- keep only landmarks that fit (6,3) (i.e., a 6-letter word followed by a 3-letter word)
- generate all landmark-element pairs
- generate all state-state pairs
- for each landmark-element pair, compare each state-state pair for a match:
- for comparison, for each pair: lowercase, remove non-letters, sort letters, join all letters to single sorted string; e.g., ["North Dakota", "Ohio"] --> "aadhhiknoooortt"
##eh###oor#v
adehimnoortv
idaho, vermont
hoover dam, tin / idaho, vermont
No comments:
Post a Comment