# The Hallway and Tele Doors

Assume you have an unlimited but finite number of linking, teleporting doors you can add to a hallway of finite length. Assuming there's a door at the start and finish, can you arrange the teleports so that one can never make it to the end of the hallway?

For example:

A B A B

Where when you enter A from the left (you'll never turn and enter from the right) you come out of the other A on the right. So you'd enter the first A, come out of the second, enter B come out of the other, hit A again, and when you exit the other and hit B you've got to the end.

You HAVE to start before the first door, and every tele door HAS to have a linking door. No combining links (AB would not have a 50 - 50 chance of A or B) and no more than 2 links, so no random linking.

Can you arrange the tele doors in such a way, you'll never reach the end? If so, how many tele doors does it require, and what's the setup? If not, prove it's impossible.

• Yeah, I thought that the given example caused an infinite loop, but looking at it again it doesn't. – JonTheMon Nov 20 '14 at 20:26
• @JonTheMon same here! :) – A E Nov 20 '14 at 20:27
• "Unlimited but finite"? I'm not quite sure what that means. In theory, if you ignore the laws of physics and the doors could fit in to infinitely small spaces, then an infinitely long sequence could be created with an "unlimited" amount of such doors. But, I guess the "but finite" clause is meant to suggest you can't fit an infinite amount in the hallway? – Bob Nov 21 '14 at 2:08
• @Bob That was my immediate reaction as well. I read this as you can use as many doors as you want, but not an infinite number. Presumably this is to prevent answers involving Xeno's paradox style physics tricks. – Esoteric Screen Name Nov 21 '14 at 2:32
• @Esoteric You read that correct :D – warspyking Nov 21 '14 at 2:39

To the best of my knowledge, it is impossible to have an infinite loop when starting on the far left.

The best reasoning I can provide is that once you enter the first door, it is impossible to ever enter that door again from the left. Since your loop is already 'breaking', you'll then never be able to enter the path between the second A-B again.

Ultimately, you run into the case where you will only ever walk the path between the two letters once. A good way to look at this is to consider the Start/End as a pair of doors themselves.

[Start] [You] A D B A C B C D ... [End]

In the long run, the only loop you're bound to be stuck in is the one you started between, which in this case is the losing factor.

It's impossible.

If you never reach the end, it must be because you got stuck in an infinite loop. This requires that you enter the same teleportation door twice at some point. Consider the first time that this happens, and what happened immediately beforehand. Because you can't go towards the left, you can only possibly enter the leftmost door once. Therefore the repeated door must have another door immediately to its left, and you must have just come out of that one both times. But this contradicts the fact that it's the first time you used a door twice.

Therefore you can't get stuck in a loop, and must eventually reach the end.

• Ah, earliest counterexample. Why didn't I think of that? – TheRubberDuck Nov 20 '14 at 20:50

A lateral thinking answer (well, not so much lateral as its complement...):

Yes, it's possible, by thinking vertically. Structure the hallway like so:
-----------A------------
start A end
------------------------

Walking through the left of door A dumps you out of the A on the ceiling, placing you once again on the left of door A. This setup also has the benefit of making it impossible to walk through the hallway from right to left, as walking through A from the right will push you upward out of the A on the ceiling, depositing you on the floor above. Or, more likely, in the middle of the solid matter creating the ceiling and killing you. Or just disallowing travel in that direction if you want to be a spoilsport about it.

Note that the A B A B placement in the question was just an example, not a requirement that the doors be placed linearly. The placement requirements only state that the doors be added in the hallway, and that you use an arbitrary but finite number of doors.

• Literally lateral! – clabacchio Nov 21 '14 at 15:18
• Now you're thinking with portals. – Tim C Nov 4 '15 at 20:37

Impossible. Walking such a path in reverse, you could never reach the starting point.

Since the number of doors is finite and you never reach the end, you will eventually reach a door for the second time, at which point you will find yourself in a loop.

This, however, is impossible. You could not have started in a loop, because no door is left of the left-most door. Nor could you have entered a loop, because walking the path in reverse, you could never leave the loop. Notice that any path you walk can be walked in reverse as well, and loops forward are also loops in reverse.

• Welcome to Puzzling Stack Exchange! Would it be possible for you to expand your answer to explain why it is correct, and how it differs from existing answers? Thank you! – Aza Nov 21 '14 at 8:18
• Thank you Emrakul! This answer doesn't differ substantially from the others, really. Actually, the main reason I posted it was because it was simply more concise and in that way clearer. I added a bit of explanation. – Michael Nov 22 '14 at 3:58
• Makes sense! Thanks for your edits; they definitely improved your answer significantly. – Aza Nov 22 '14 at 4:01

DISCLAIMER: This should possibly be a comment but I don't have the reputation to do that :( It is NOT proof, just perhaps a start on the idea.

Let's start by considering what we know. Every time the 'player' hits a door from the left, they exit the corresponding from the right. Hence the player, in order to leave the circuit of doors, must exit the last door on the line. If the player leaves the last door, $a_2$, then they must enter it's correspondent door, $a_1$. So in order to create an infinite loop, we would have to make sure that this never happens.

In short, we would have to place the correspondent door $a_1$ such that it was never passed in part of our theoretical infinite loop of teledoors. If this was the case for door $a_1$, it would have to be effectively sectioned off from the remaining teledoors such that it could never be accessed by the player. To do this, let's say we were to use a set of doors, $p_1$ and $p_2$, to surround door $a_1$ so that it could never be entered. By entering door $p_1$ we would exit from $p_2$ on the other side of $a_1$, skipping it altogether.

However, what would happen after that? Consider the incomplete sequence of doors $p_1, a_1, p_2, q_1, a_2$. Here we are left with the issue of where to place our 'restarter', $q_2$. After all, in an infinite loop of a finite number of doors, the sequence must iterate. Hence, with nowhere to place $p_2$ so that the loop is infinite, we may assume that an infinite loop is impossible to create.

• Putting that as an answer was right. Comments don't allow line breaks or the MathJax formatting (I believe), so that'd have been a mess to read. ^^; – Xrylite Nov 20 '14 at 21:11

If I understood correctly, the doors effectively reverse the direction of the traveller, so in the example:

AA

The traveller would enter the left-hand A travelling left to right, exit the right-hand A travelling right to left, thereby entering the left-hand A again, this time exiting right-hand A going left to right and ending her run.

There is no solution where the traveller would turn around and head back the other way because the traveller is always travelling forward in the sequence, regardless of the number of doors she travels through.

I had a look at a way of producing a mirror, forcing the traveller to hit a wall and travel back the way they came, but all the doors act in the same way. You would need a type of door that doesn't reverse the direction of the traveller in order to... reverse the direction of the sequence.

Doors are always paired, so the traveller is always reversed twice (i.e. no change) eventually before exiting the sequence.

• I think you misunderstood. By my reading if you go in the left of one door you come out of the right of the matching door so you in fact keep going in the same direction at all times. – Chris Nov 20 '14 at 21:07
• The way I understood it is the teleports preserve direction. So traveling the AA example would essentially look like this [----->A A----->] – Warlord 099 Nov 20 '14 at 21:13
• Ahhh, okay. Yep, re-reading the OP it's clear I misread. Sorry! – oliver-clare Nov 20 '14 at 22:42