There's more than one way to solve the Hexagon Problem ― it has a surprisingly simple solution.
To start, let's consider every possible combination of unique hexagons with two open sides. We'll do this by numbering a the top side of a hexagon as 1, the one clockwise of that as 2, and so on, until we wind up at six on the final side:
Then, we'll construct a table of possible side combinations based off the numbering system above. Since there must be two open sides, we'll eliminate the diagonal row of the table (which would result in only one open side). We'll also leave the bottom left triangle of the table blank, as a hexagon with sides 2 and 4 removed is the same as a hexagon with sides 4 and 2 removed. That leaves us with 15 possible hexagons:
Now, let's go back to the problem. We're trying to find out how many unique rooms we can connect, so we can automatically set the answer somewhere from 0 (if no rooms can be connected) and 15 (if all rooms can be connected). Great! We've narrowed our search down to 16 possible answers.
Consider the hexagon with labeled sides again. We'll place a dot at the midsection of each hexagon side to represent an opening:
Now, we can represent the open sides of each hexagon as a slope by drawing a line from the two dots that represent open sides:
If we take a look at the earlier table and represent the open sides as slopes, we can see an array of different slopes:
If we consider each line as a vector of length one with the slope calculated from the two open sides and graph all vectors, we end up where we started:
Because the sum of the vectors equals zero, the slopes of the open sides for all 15 rooms cancel, meaning that there must exist some configuration of rooms such that the conditions of the problem are satisfied. Solved. The solution: 15.
But, finding the answer to the puzzle was half the challenge ― now, I felt obligated to find an example. After tinkering around for half an hour or so (trust me, finding an example of a 15 room loop is harder than it looks), I found a solution:
The moral of the story: if you ever get lost in the Library of Babel, you're not getting out without a map.