23

Each pipe shown on the left (A through I) connects to exactly one pipe on the right.

To hide the answer, I have put a curtain over the pipe crossings and grayed out the pipe colors on the right side.

When behind the curtain, each pipe travels straight to the leftmost side of its associated numbered gray pipe. In other words, the pipes have no bends or curves, other than the possible single bends just inside either side of the curtain.

enter image description here

Using the clues below, can you figure out where each pipe is connected? Note, there is only 1 possible solution.

  1. Pipe A crosses either 2,3,4,5, or 6 pipes.
  2. Pipe B crosses either 3,4,5, or 6 pipes.
  3. Pipe C crosses at least 2 pipes.
  4. Pipe D crosses at least 5 pipes.
  5. Pipe E crosses at least 6 pipes.
  6. Pipe F crosses at least 5 pipes.
  7. Pipe G crosses at most 4 pipes.
  8. Pipe H crosses at most 3 pipes.
  9. Pipe I crosses at most 4 pipes.
  10. There are at least 19 pipe crossings in total. *see bullet below
  • Remember: When counting pipe crossings, be careful not to count each one twice. More specifically, if you add up Pipe A's crossings + Pipe B's crossings + ... + Pipe I's crossings, the sum you get will be double the actual total number of pipe crossings, since each crossing would be counted twice.

Answers can be in the form of

A-->1 B-->2 C-->3 D-->4 E-->5 F-->6 G-->7 H-->8 I-->9

Or, even better, assuming the left side is ordered A through I, just

123456789

If you solve this puzzle using only logic, and without using computer code, and then convince me of that using a detailed explanation, then I will award you 300 rep points, on top of the +10 up-vote and +15 for the accepted answer.

However, I doubt that it's feasible to solve without code, but I have been surprised many times before, so who knows.

Rand al'Thor
  • 116,845
  • 28
  • 322
  • 627
JLee
  • 18,202
  • 2
  • 55
  • 172
  • Does each pipe have a straight connection from letter to number? Or could a pipe have a bend in it, theoretically being able to cross another pipe twice? – JonTheMon May 21 '15 at 15:10
  • @JonTheMon From the question: "When behind the curtain, each pipe travels straight to the leftmost side of its associated numbered gray pipe. In other words, the pipes have no bends or curves, other than the possible single bends just inside either side of the curtain." – JLee May 21 '15 at 15:47
  • 1
    300 rep is a lot, someone will somehow manage to get it from you. It should be logically feasible! – ghosts_in_the_code May 21 '15 at 16:30
  • @ghosts_in_the_code Good, I hope they do. If they can fully articulate the logical process, then it's theirs! – JLee May 21 '15 at 17:12
  • @JLee But with two independent computer-free solutions, who's the winner? :-) (Not counting ghosts_in_the_code since his answer was incomplete, or JontheMon since his answer has some arm-waving "let's push this pipe this way" rather than eliminating all possibilities rigorously - although of course his final answer is verifiable.) – Rand al'Thor May 21 '15 at 17:41
  • 1
    @randal'thor i am slowly and methodically going through your explanation and bailey's explanation now. i am slowed down because i am at work, and multi-tasking. quite frankly, so far, i understand your logic better and quicker, as it is articulated better, but if hers is logically correct (I'm not done checking either yet), then I feel like I must put this forth to the community to decide. What do you think? – JLee May 21 '15 at 17:45
  • @JLee Well, there's no doubt Bailey got there first, but I promise I solved it independently! Asking "which do you think I should accept?" on Meta invariably gets only responses of the form "whichever you like - you're the OP", so it's completely up to you. You can't even judge by which one has more votes, since Bailey has a headstart due to posting first. I guess it comes down to "the one you like best", although a lot of people tend to accept the first correct solution. OTOH I'm the wrong person to ask for advice! :-) – Rand al'Thor May 21 '15 at 17:50
  • 1
    @randal'thor Bailey was definitely first to answer correctly, and first to give a detailed solution, which does count for something. Also, both solutions seem logically correct to me, although a couple parts of hers are not 100% clear (but I think that is because her understanding is better than mine). She will get the check mark, but I will leave it up to the community to vote on which detailed explanation is better. But I guess I have to wait 2 days to put a bounty on it. – JLee May 21 '15 at 17:58
  • 2
    Hope you don't mind I've edited out the computer tag. It might scare off people like me who know nothing about programming (I only looked at this question on the off-chance it might be something interesting, then realised it was doable without a computer). Also, maybe you could edit in what you said in comments that there's a unique solution? – Rand al'Thor May 21 '15 at 20:09
  • Both Bailey and rand posted great answers, it's very difficult to choose the best one. I'm glad that both receive a bounty! My vote for the 200 prize goes to Bailey, for a couple of minor reasons: he was very fast finding the solution (just 20 minutes) and he's a relatively new promising user, who deserves this bounty as cheer! – leoll2 May 24 '15 at 19:36
  • @leoll2 Yeah, I was going to suggest splitting the bounty - and it's certainly true that I 'need' the rep less :-) But maybe JLee should've waited to accept an answer until after voting was over, since there's a tendency (FGitW) for the highest answer to get more drive-by UVs by people who can't be bothered to scroll down and read the others, and acceptance has ensured Bailey's will be highest however the voting goes. – Rand al'Thor May 24 '15 at 19:47
  • @randal'thor ok, good point, i un-accepted her answer for now. BTW, what is FGitW? – JLee May 25 '15 at 01:09
  • @leoll2 i agree with your assessment totally. btw, bailey is a girl's name, isn't it? – JLee May 25 '15 at 01:10
  • @JLee I thought Bailey was a surname – leoll2 May 25 '15 at 11:21
  • Humorously, Bailey can be both of those things, yet in my case it is a boy's name as well. :) I appreciate the compliments! I think any bounty awarded to either me or rand for this question is well-deserved. – Bailey M May 25 '15 at 14:53
  • the site is making me wait 24 hours to award the 200 points to Bailey M – JLee May 30 '15 at 23:05

4 Answers4

16

Okay, I've once again solved the problem, using only logic and Microsoft Paint! The acceptable solution I found is:

$482971356$

The following is a count of crossings per pipe and total:

Pipe A crosses $3$ pipes.
Pipe B crosses $6$ pipes.
Pipe C crosses $3$ pipes.
Pipe D crosses $5$ pipes.
Pipe E crosses $6$ pipes.
Pipe F crosses $5$ pipes.
Pipe G crosses $4$ pipes.
Pipe H crosses $3$ pipes.
Pipe I crosses $3$ pipes.
There are $19$ total pipe crossings.


Here are the logical steps to solving this problem.

Step 1: Pipes C and F

ghosts_in_the_code did a great job explaining why C and F are the only pipes that can connect to 1 and 2. Since their order doesn't matter in terms of crossing other pipes, and we're trying to maximize crossings, we attach F to 1 and C to 2 such that the pipes cross.

Step 2: Pipes G, H, and I

Since we're still trying to maximize for crossings, we want each of these pipes to have as many crossings as they can. Since these pipes have an "at-most" amount of crossings, there is a max point we can place them on the right side. We know that C and F are already in spots 1 and 2, and therefore can't possibly cross G, H, or I, so the two with an "at-most" of 4 crossings can be put in their highest possible spots as this setup would have none of the three crossing each other (leaving a maximum of four possible crossing pipes - A, B, D and E). For G, the highest point would be spot 3. For I, the highest point would be spot 5. However, H can't be placed at spot 4, since it has an "at-most" of 3 crossings, not 4. We can't place H at spot 6 or lower, or pipe I would cross pipe H and pipe I would have too many crossings. Because of this, we have to shift I down one spot so that H can be in spot 5 (which is its highest possible spot based on the above restrictions). Pipe I will therefore end up in spot 6.

Step 3: Pipe E

E needs to cross 6 pipes total. It already can't cross pipe C. If it were put at spot 8, it wouldn't cross pipe A either, and putting it at spot 7 would mean that pipe A would have to travel too far (a max of 6 crossings). This means that it can't cross pipe A either. There are only 6 pipes left, so pipe E has to cross all 6 of them, which it can't do in spots 4, 8, or 9, leaving only spot 7 (as B and D can travel to the two spots below it).

Step 4: The remainders

A can only go into one spot now, or else it would be above its maximum crossings (6). This connects A to 4. B can now only go in one spot, or else it would be above its maximum crossings (also 6). This means that B connects to 6. D is the remaining pipe, and it connects to the last remaining spot, which is 9.

Bailey M
  • 16,973
  • 2
  • 69
  • 119
  • I've fixed my solution to properly answer the question! – Bailey M May 21 '15 at 16:17
  • 1
    That is correct. I am looking forward to seeing how you did this using just logic. I am sure I will learn something! – JLee May 21 '15 at 16:20
  • Let me see if I can clear it up! – Bailey M May 21 '15 at 17:06
  • Microsoft Paint - how modern of you! I just used pen and paper ;-) – Rand al'Thor May 21 '15 at 17:38
  • +1 Good job! And so fast! I will accept this answer, but for the 300 point bonus, I will leave it up to the community to decide which detailed logical explanation is the best. At this point, it looks like it is between you and rand. I think I have to wait 2 days to put a bounty on it. – JLee May 21 '15 at 18:02
  • 3
    Uh-oh! I'm not sure I'm prepared to pick a fight with rand, especially on his home turf. :) – Bailey M May 21 '15 at 19:14
  • @BaileyM Nobody said anything about a fight! :-) I'll be happy whatever happens; it was a fun puzzle to solve. Funny though that JontheMon's answer has more votes than either of ours: I guess people find it easier to understand and don't care about the rigour of eliminating all possibilities. – Rand al'Thor May 21 '15 at 20:07
12

I've managed to solve it (without looking at any of the 3 existing answers) using only logic, pen, and paper! Here's the exact argument I used, in order. Note that I've sacrificed brevity for (hopefully!) clarity :-)

First pass

Pipe A crosses either 2,3,4,5, or 6 pipes.

This is exactly equivalent to saying pipe A goes to 3,4,5,6, or 7 (since the number of pipes crossing A is the number of pipes above the one A goes to).

Pipe B crosses either 3,4,5, or 6 pipes.

So B can't go to 1 or 2 (since then it would only cross A and at most one other pipe), or to 9 (since then it would cross all pipes other than A).

Pipe D crosses at least 5 pipes.
Pipe E crosses at least 6 pipes.

So D/E can't go to 1 or 2 (since then it would cross at most A,B,C, and one/two others).

Pipe F crosses at least 5 pipes.

By symmetry with D, F can't go to 8 or 9.

Pipe G crosses at most 4 pipes.

So G can't go to 1 or 2 (since then it would cross all but at most one of A to F).

Pipe H crosses at most 3 pipes.
Pipe I crosses at most 4 pipes.

So H/I can't go to 1,2,3, or 4 (since then it would cross all but at most three of A to G/H).

Summing up our progress so far:

A goes to one of 3,4,5,6,7
B goes to one of 3,4,5,6,7,8
D goes to one of 3,4,5,6,7,8,9
E goes to one of 3,4,5,6,7
F goes to one of 1,2,3,4,5,6,7
G goes to one of 3,4,5,6,7,8,9
H goes to one of 5,6,7,8,9
I goes to one of 5,6,7,8,9

We notice that

C and F are the only pipes that can go to 1 or 2, so these two pairs must match. If F went to 2, the only pipes it could cross would be A,B,D,E - not at most five, so C goes to 2 and F goes to 1. With this new information, let's see what more we can deduce.

Second pass

Pipe D crosses at least 5 pipes.
Pipe E crosses at least 6 pipes.

So D/E can't go to 3 or 4 (since then it would cross at most A,B,F, and one/two others - remember we now know C goes to 2).

Summing up again:

A goes to one of 3,4,5,6,7
B goes to one of 3,4,5,6,7,8
C goes to 2
D goes to one of 5,6,7,8,9
E goes to one of 5,6,7
F goes to 1
G goes to one of 3,4,5,6,7,8,9
H goes to one of 5,6,7,8,9
I goes to one of 5,6,7,8,9

We notice that

A,B,G are the only pipes that can go to 3 or 4. So at least one of A,B must go to one of 3,4 and therefore not cross either D or E. This means D/E can't go to 5 or 6 (since then it would cross at most {one of A,B}, F, and two/three others). Now the only place E can go is 7.

If neither A nor B crossed E, then E would cross at most five pipes. Contradiction, so one of A,B must go below E, i.e. to one of 8,9. By the restrictions we found in the first pass,

B goes to 8.

So

A and G pair up with 3 and 4.

Summing up again:

A goes to one of 3,4
B goes to 8
C goes to 2
D goes to one of 7,8,9
E goes to 7
F goes to 1
G goes to one of 3,4
H goes to one of 5,6,7,8,9
I goes to one of 5,6,7,8,9

We notice that

H and I are the only pipes that can go to 5 or 6, so these two pairs must match. If H went to 6, it would cross I and the pipes going to 7,8,9; contradiction, so H goes to 5 and I goes to 6. Now D is the only pipe that can go to 9.

The only pipes left to match up are {A,G} and {3,4}, which we can do using the final constraint: to get at least 19 crossings overall, we need A to go to 4 and G to 3. So the final answer is:

482971356.

Rand al'Thor
  • 116,845
  • 28
  • 322
  • 627
10

I think I had an initial answer of:

382 971 456

So, pipe E is the hardest, since it has to cross all 4 above/below it, and 2 on the other side. We know that GHI don't want many crossings, so let's send C downwards, with 2 spots below it for crossing (7), and bring GHI up above it (456). F needs to cross a lot of pipes, so up to (1).

So, now let's just take the next 2 pipes (CD) and move them down to (89).

Now we have to deal with A and B. With only spots (23) left, A-3 can make it's 2 crossing, but B can't. (See picture 1).

So, since pipe C has a low threshold and B has a high cap, move C-8 to B-8 (6 crossings), and C-2 has 3. (See picture 2)

A - 2 crossings
B - 6 crossings
C - 3 crossings
D - 5 crossings
E - 6 crossings
F - 5 crossings
G - 3 crossings
H - 3 crossings
I - 3 crossings

enter image description here

But we only have 18 crossings. Well, that should be easy to fix, since we can cross A and G easily. (See picture 3)

So, final order:

482 971 356

And crossing counts:
A - 3 crossings
B - 6 crossings
C - 3 crossings
D - 5 crossings
E - 6 crossings
F - 5 crossings
G - 4 crossings
H - 3 crossings
I - 3 crossings

JonTheMon
  • 9,910
  • 36
  • 56
7

Incomplete answer

C and F are the only pipes that can connect to 1 or 2.

If Pipe A connects to 1, it has no crossings. If it connects to 2, it has only 1 crossing (A).

If Pipe B connects to 1, it has 1 crossing. If it connects to 2, it can have upto 2 crossings (A and B)

If Pipe D connects to 1, it has 3 crossings (A,B,C). If connected to 2, it can have 4 crossings (A,B,C,any other pipe that reaches 1)

Similar logic for Pipe E.

If Pipe G, H or I reaches 1 or 2, they have far too many crossings.

ghosts_in_the_code
  • 7,024
  • 1
  • 30
  • 100