Creating a Gridogram

All the words in the following quote can fit, Boggle-style, in a 4x4 grid:

Space is to place as eternity is to time.

Try it yourself: set letters in the grid so that all words in the above quote are underlined. One cell can even be left blank, there are multiple solutions.

▶️ See & Play a Solution

The first Gridograms were created with pencil and paper, trial and error, using heuristics you may have discovered when filling in the grid above. It’s kind of a fun exercise, a little like sudoku.

First pencil and paper Gridogram

But how did we know that a 4x4 grid was the right size for the quote?

Estimating Grid Size

Take the letters used in “Space is to place as eternity is to time.”, noting that T and E are needed twice to spell “eternity”:

ACEEILMNOPRSTTY

That’s 15 letters, and for this quote 15 is also the actual number of cells needed. We use 4x4 rather than 5x3 to keep Gridograms near square, as 𝑛x𝑛 or 𝑛x𝑛−1.

Often, however, this counting exercise only provides a lower bound, not the exact number of cells needed. Let’s try another quote:

Thank heavens, the sun has gone in, and I don’t have to go out and enjoy it.

Letters used:

ADEEGHIJKNOSTUVY

That’s 16 letters, so another 4x4 grid? Nope, that won’t be big enough to include all the words in the quote. Can you figure out a reason why? (I’ll come back to this.)

So why can’t “Thank heavens, the sun has gone in, and I don’t have to go out and enjoy it” fit in a 4x4 grid? Hint: look at those underlined letters.

Cells in a grid corner connect with 3 others. Cells along an edge connect with 5. Cells away from the edges have the most connections: 8.

Number of connections for grid cells in different positions

The letter N in the quote is very friendly: it wants to be next to A, D, E, I, J, K, O, S, and U. That’s 9 different letters, more adjacencies than one grid cell can have!

So the grid will need more than one N. Updating the letter list to ADEEGHIJKNNOSTUVY gives us a new lower bound of 17 letters. The quote does indeed fit in a 5x4 grid, you can try to create one below (3 cells can be left blank).

Thank heavens, the sun has gone in, and I don’t have to go out and enjoy it.

▶️ See & Play a Solution

How can we programmatically take account of cases like this quote, to better estimate grid size? With undirected graphs!



[1]: The On-Line Encyclopedia of Integer Sequences (A236690). Even getting a count for how many paths exist is not trivial. I wrote a naive Fortran program (new language for me, wanted to try it) to exhaustively count the paths for 2x2 (64), 3x3 (10,305), and 4x4 (12,029,640) grids. 5x5 was taking some time to compute, fortunately pasting the path counts for smaller grids in Google led me to the OEIS.