Consider the following building floor plan, with a set of rooms labeled A-G and an Outside:

                                                     the building floorplan

The lines between each pair of blue dots are walls. Ordinarily in problems like this the goal is to draw a single continuous curve that passes through each wall once and only once, ending up back in the room where the curve was started (a so-called "Hamiltonian cycle").

However, for this particular set of rooms, the real challenge is to get stuck. Getting "stuck" means you draw your curve so that you eventually have no way of exiting the room you're in (because you've passed through all of its walls once) even though you haven't passed through all the walls in the building.

You can start your curve in any room, but not on the outside of the building.

Can you get stuck on purpose?

To present your solution to the problem, please give the sequence of rooms your curve passes through, beginning with the room you start in. For example, a curve that starts in room G and ends at the x (as shown below) has the sequence G Out B A Out.

                                                     codifying curves


One solution would be to "use up" all of the walls except one, and then enter the room for the last time:


The syntax for this would be CBACFDCEGC.

This can be done for any room. If the room has an even number of walls, start inside of it (so that it has an odd number when you leave and actually start "using up" walls two at a time); otherwise, start outside (so that you can "consume" two walls at a time until there's only one left, which you then enter).

All of these rooms have an even number of walls. Therefore, to successfully solve this problem, you must start in the room that you end in.

  • 1
    $\begingroup$ Crud. I forgot a wall. I guess we can chalk this one up as a candidate for "easiest brainteaser o' the month". :P $\endgroup$ – COTO Nov 4 '14 at 2:34
  • $\begingroup$ Actually, I'll delete the question and post it anew once it's fixed. $\endgroup$ – COTO Nov 4 '14 at 2:36
  • $\begingroup$ Apparently I can't. So... I won't. $\endgroup$ – COTO Nov 4 '14 at 2:37
  • $\begingroup$ @COTO You could edit the question, and I wouldn't mind fixing my answer to match it. $\endgroup$ – Doorknob Nov 4 '14 at 2:39
  • 1
    $\begingroup$ We'll chalk it up as a happy mistake. Who knows. Maybe the solution to this puzzle won't be as obvious to some people. ;) $\endgroup$ – COTO Nov 4 '14 at 2:43

enter image description here

Not sure if that counts, as I didn't understand your statement of "even though you haven't passed through all the walls in the building" so I just did it until all walls had been passed anyway.

The key lies in making best use of room F and G, the only odd-wall-numbered rooms in the diagram. Code: FoFDoDEoEGoGoBoAoFACFDCEGBCBA

  • 1
    $\begingroup$ I think the question was asking for a way to get stuck without using all of the walls. Also, even with your answer as it is, there are two things wrong. First, you can still go to F from your position at the end, and second, F and G are not odd-wall numbered rooms - they both clearly have 8 walls. $\endgroup$ – mdc32 Nov 4 '14 at 22:30
  • $\begingroup$ Oh, I must have miscounted. And of course I know it's possible to go back to F if I wanted to, I just thought the question was asking if it was possible to find a path that does not end back at the start and gets stuck in the room it ends in. $\endgroup$ – Ashizen Nov 5 '14 at 13:51
  • 1
    $\begingroup$ But you aren't stuck at A. There's still an opening on the left-hand side of A, bottom wall. You pretty much just gave a Hamiltonian cycle as an answer, even though the question says not to. $\endgroup$ – mdc32 Nov 5 '14 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.