aspose file tools*
The moose likes Programming Diversions and the fly likes cross the river Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "cross the river " Watch "cross the river " New topic
Author

cross the river

Stevie Kaligis
Ranch Hand

Joined: Feb 04, 2001
Posts: 400
Three men, A, B, C and their respective wives, Aw, Bw and Cw, were hunting in deepest Peru, when they came across a large river. Luckily there was one boat, however, it could only carry two people at the same time. Due to bitter jealousy, no woman could be left with another man unless her husband was present. How did they manage to cross the river?
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
They divorced their husbands. Now they can cross the river with any man.


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
"Cross the river" - is that what they call it these days? !
Heh. There are also a number of interesting solutions involving murder. I suppose it depends on what everyone's goals really are in this problem.
But, playing along with the presumed intent of the puzzle: I have a solution requiring 11 crossings. It can be shown that the number of crossings must be odd, and that there must be at least 9 crossings (if all trips one way take 2 people, and all return trips have 1 person). It doesn't seem to be possible to actually achieve 9 however. Perhaps I'm mistaken. There are a number of equivalent solutions for 11 - here's one:

I replaced "Aw" with "a", and so on, to save myself some typing and improve readability. The boat is indicated with "+".
<pre>ABCabc+
ABCa1 +bc
ABCa+bc
ABCa2 +bc
ABCab+c
ABC3 +abc
ABC+abc
ABC4 +abc
ABCa+bc
Aa5 +BCbc
Aa+BCbc
Aa6 +BbCc
ABab+Cc
ab7 +ABCc
ab+ABCc
ab8 +cABC
abc+ABC
c9 +abABC
c+ABCab
c10 +CABab
CcABab
11 +CcABab
+ABCabc</pre>
What I found most surprising is step 6. We had sucessfully gotten 4 out of 6 people across, and then we send back not 1 (which would hve been necessary anyway to get the boat back) but 2. It looks like a significant step backwards. And yet, it works.
Of course, Map will probably suggest a simple modification:
<pre>ABCabc+
ABCa1 +bc
ABCa+bc
ABCa2 +bc
ABCab+c
ABC3 +abc
ABC+abc
ABCabc
ABCabc
...
</pre>
Which may well be best for everyone.

[ February 17, 2002: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Cross the river, which river? you mean the Jordan River?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yeah, the part of the Jordan River that goes through Peru. :roll:
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Oops.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Originally posted by Jim Yingst:

<pre>ABCabc+
ABCa1 +bc
ABCa+bc
ABCa2 +bc
ABCab+c
ABC3 +abc
ABC+abc
ABC4 +abc
ABCa+bc
Aa5 +BCbc
Aa+BCbc
Aa6 +BbCc
ABab+Cc
ab7 +ABCc
ab+ABCc
ab8 +cABC
abc+ABC
c9 +abABC
c+ABCab
c10 +CABab
CcABab
11 +CcABab
+ABCabc</pre>

Jim, what you were thinking about when solving this puzzle? :roll: Requirements clearly said: "no woman could be left with another man unless...". To touch a bank to through a man out of boat cannot be considered "left with". Women draw lots, one who was unlucky drinks some vodka and makes first 6 crossings, bringing other women and their husbands to other side. Rest is trivial. Thus, we have only 9 crossings.
<pre>
ABCabc+
ABCa1 +bc
ABCa+bc
ABCa2 +bc
ABCab+c
ABa3 +bCc
ABa+cC
ABa4 +bcC
ABab+ cC
Aa5 +bBcC
Aa+bBcC
Aa6 +bBcC
Aab+BcC
b7 +aABcC
b+aABcC
b8 +BaAcC
bB+aAcC
9 +bBaAcC

</pre>

See, how your wrong set of ideas can prevent you from clear thinking.
[ February 17, 2002: Message edited by: Mapraputa Is ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
> no woman could be left with another man unless her husband was present
OK, left here is clearly the past participle of leave. But which definition is understood for leave? I think I see where you're coming from - you're using the "to go out of or away from" definition. I'm interpreting it using the "to have as a result or consequence" definition.
In your step 3, b and C are alone in the boat together. From the perspective of the other people, they have been left together - the other people have allowed this to happen, by agreeing to the plan. Who knows what might happen on the boat on the way over? Likewise, between steps 6 and 7, A is ashore with a and b. Husband B is on the other shore going mad with jealousy as he becomes convinced that A and a are going to get together in a threesome with b (who of course has already had plenty of fun on the boat with C, as far as B knows). Sure, the plan was to only touch shore briefly between steps 6 and 7 - but what if A or a isn't ready to go yet (or claims not to be?) Or what if b, now all hot and sweaty from all that rowing, suddenly acts as if she's about to faint, causing A and a to linger to make sure she's OK? What is B going to think during all this? :roll:
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
But which definition is understood for leave? I think I see where you're coming from - you're using the "to go out of or away from" definition. I'm interpreting it using the "to have as a result or consequence" definition.
You missed a lot of other interesting and potentially promising definitions:
6. To give over to another to control or act on
7. To abandon or forsake.
8. To give or deposit, as for use or information, upon one's departure or in one's absence.
9. Nonstandard. To allow or permit; let.
Or did you consciously decided to ignore them? Since they favor my interpretation of requirements?
In your step 3, b and C are alone in the boat together. From the perspective of the other people, they have been left together - the other people have allowed this to happen, by agreeing to the plan. Who knows what might happen on the boat on the way over?
Well, it largely depends on how wide the river is. Let's take the worst-case scenario. What is Peru's widest river? And even if the river is wide enough to make people in boat invisible, what can really happen with these two in a small wobble boat?
Likewise, between steps 6 and 7, A is ashore with a and b. Husband B is on the other shore going mad with jealousy as he becomes convinced that A and a are going to get together in a threesome with b (who of course has already had plenty of fun on the boat with C, as far as B knows).

I do not even know where to start except to say that I am totally shocked.
Jim... How, how... How could you? How could you think about all this? I know you long enough and I always admired your disciplined intellectual approach and flawlessly logical way of thinking. If b has already had plenty of fun, what is her motivation to to get together... not even in an adultery, but in a double-adultery? Where is your logic? :roll:
Sure, the plan was to only touch shore briefly between steps 6 and 7 - but what if A or a isn't ready to go yet (or claims not to be?)
Now what do you mean isn't ready (or claims not to be?) What is it he is so busy with? Wasn't the whole gang agreed simply to cross the river?
Or what if b, now all hot and sweaty from all that rowing, suddenly acts as if she's about to faint, causing A and a to linger to make sure she's OK?
That would be a good plan, actually. If not A's wife who watches the whole scene in full amusement. Shouldn't we improve requirements by saying:
"no woman could be left with another man unless her husband or that man's wife was present"?
What is B going to think during all this?
Well, if to follow your way of thinking :roll: , he is left with C's wife, so he has something to think about... For example, to take revenge for all that fun C supposedly had with B's wife on their way... See, my solution even has some mathematical elegance.
[ February 18, 2002: Message edited by: Mapraputa Is ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Or did you consciously decided to ignore them? Since they favor my interpretation of requirements?

Let's pretend for a moment that your last statement is true. :roll: The number of definitions is irrelevant - only one need apply. The rule about being "left alone" was explicitly tied to jealousy among the party. Why would someone be jealous abou time spent together after being left on shore, and not concerned about time spent together period?
what can really happen with these two in a small wobble boat?

Hey, the boat wobbles - that means that the two might be thrown together "accidentally". As for visibility issues - well, evidently either (a) you can't see clearly all the way across the river, (b) the people involved cannot be trusted to stay in the visible areas, or (c) people just don't care if they're seen. Otherwise everyone could have just agree to stay where everyone could see them, and there would be no problem to begin with.
It's not clear exactly what everyone is really worried about anyway. Perhaps the mere act of private conversation is seen as a threat - laying groundwork for later seduction, perhaps, or just telling jokes about what a jerk B is. Perhaps the guys think, rightly or wrongly, that their wives would willingly throw themselves at other men. Or that the other men would force themselves on their wives, even with the pther men's own wives present. In all these examples but the first (re: conversation), it would not work to allow A, a, and b to be together even briefly - as I previously argued. In general it sounds like the people in this group are either evil, horny, or just plain stupid. Or some combination of these. (Which is why I liked the three-step solution I mentioned earlier.) But I have a hard time coming up with good reasons why the ban on men being with unchaperoned women should not apply to boats and supposedly "brief" visits on land as well.
If b has already had plenty of fun, what is her motivation to to get together... not even in an adultery, but in a double-adultery? Where is your logic?

Those particular sentences were basically assuming that either b is a horny slut, or B is a hyper-jealous moron. Either way, things don't look too good for this marriage.
Wasn't the whole gang agreed simply to cross the river?

As a group, yes, they all claimed to agree. But if they all trusted each other to do what they originally agreed to, then there would have been no problem for us in the first place.
Shouldn't we improve requirements by saying:
"no woman could be left with another man unless her husband or that man's wife was present"?

That would be a perfectly reasonable requirement for another (easier ) problem. For this problem it seemed to be quite intentional in the set-up that the presence of a man's wife didn't really matter to anyone. This is a sad, pathetic group of people, really.
he is left with C's wife, so he has something to think about

He's left with C's wife, and C. Which according to the problem statement is enough to prevent any problems. But realistically, C is probably tired at this point from his exertions. Meanwhile c is frustrated at having missed out on all the action, since she's been carefully chaperoned so far, and both B and c have a lot of pent-up frustration over what seemed to be going on in the boat. So maybe they will gang up on C, knock him out, and toss him into the river. Not a bad idea, really. The more I think about these annoying people, the more I'm inclined towards the solutions that involve one or more of them being murdered.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Why would someone be jealous abou time spent together after being left on shore, and not concerned about time spent together period?
That's the deepest formulation of the problem I've ever seen. For some reasons, people are only conserned with, so to speak, physiological adultery, totally ignoring possibilities of emotional or even spiritual adultery, which are much worse a crime in my opinion, yet they do not bother anybody. Oh well.
Hey, the boat wobbles - that means that the two might be thrown together "accidentally".
Hey, have you ever been in a boat? "accidentally thrown together" - never happens, but if you will try to do it intentionally... :roll:
As for visibility issues - well, evidently either (a) you can't see clearly all the way across the river, (b) the people involved cannot be trusted to stay in the visible areas, or (c) people just don't care if they're seen. Otherwise everyone could have just agree to stay where everyone could see them, and there would be no problem to begin with.
And what made you think there is a problem? All we have is "no woman could be left with another man" and for me it somehow communicates an idea of immobility. Being in a moving boat - can it be called "be left"?
It's not clear exactly what everyone is really worried about anyway. Perhaps the mere act of private conversation is seen as a threat - laying groundwork for later seduction, perhaps, or just telling jokes about what a jerk B is. <...> But I have a hard time coming up with good reasons why the ban on men being with unchaperoned women should not apply to boats and supposedly "brief" visits on land as well.
Ah, that's a good point. I was concerned with a demonstrable physiological adultery whereas there are subtlier forms of aforementioned adultery, A, B and C can be concerned with.
As a group, yes, they all claimed to agree. But if they all trusted each other to do what they originally agreed to, then there would have been no problem for us in the first place.
Another good point.
He's left with C's wife, and C. Which according to the problem statement is enough to prevent any problems. But realistically, C is probably tired at this point from his exertions.
That's very true! Most likely he is either too tired to rebuff, or just doesn't care - after all this.
Meanwhile c is frustrated at having missed out on all the action, since she's been carefully chaperoned so far, and both B and c have a lot of pent-up frustration over what seemed to be going on in the boat.
What are you talking about? They already "had plenty of fun" if to use our terminology :roll: - on the step 3!
So maybe they will gang up on C, knock him out, and toss him into the river. Not a bad idea, really. The more I think about these annoying people, the more I'm inclined towards the solutions that involve one or more of them being murdered.
Ha! I knew you have extremely penetrating brain! Now real question is: what is the minimal number of people murdered that would effectively solve the problem? Idea of minimum is important from both intellectual and humanitarian points of view.
[ February 18, 2002: Message edited by: Mapraputa Is ]
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8764
    
    5
I think this should be moved to the 'diversions' forum because without the additional constraints of light switches and polar bears this puzzle is obviously too easy for you guys.


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Sure, why not...
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Three men, A, B, C and their respective wives, Aw, Bw and Cw, were hunting in deepest Peru, when they came across a large river. Luckily there was one boat, however, it could only carry two people at the same time. Due to bitter jealousy, no woman could be left with another man unless her husband was present. How did they manage to cross the river?
1. A,Aw go first
2. A brings boat back
3. B,Bw go across
4. Aw brings boat back
5. C,Cw go across
6. Cw brings boat back
7. Aw,Cw go across
8. Aw brings boat back
9. A,Aw join the others

Aw murders her husband A for not trusting her enough and making her cross the river 5 times !
Cw pokes out eye of husband for same reason and she had to cross the river 3 times.
B and Bw have never been tested and live happily ever after.
regards
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
1. A,Aw go first
2. A brings boat back
3. B,Bw go across

Now B, Bw, and Aw are together on one side. Is this acceptable? I don't think so, but it depends on how we interpret the original problem statement, as discussed above.
4. Aw brings boat back
5. C,Cw go across
6. Cw brings boat back

Uh, oh! A, Aw and Cw are together on one side. Will the wives depart immediately, or will they delay?
7. Aw,Cw go across
And now, everyone except A is in one place. Who will protect Aw from B and C? Or, how does A know that nothing happened?
8. Aw brings boat back
9. A,Aw join the others
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Ok, so I did not fully understand the problem.
posted by Map:
Hey, have you ever been in a boat? "accidentally thrown together" - never happens, but if you will try to do it intentionally...


The Titanic. Kate and Leo did depict the thrown together unintentionally bit quite well. And see where that got them ?
Unless , the unseen hand of the gods... Did the problem say Peru ?..The unseen hand of god has been known to be quite active in those parts.
Start a rumour and cultivate a fear that the unseen hand of GOD will strike the husband who messes with another woman in front of his wife.
(If rumour is about messing with woman , period, that may have the undesirable effect of leaving no problem to solve. And idle hands of God can get up to wreaking storms, famines, blizzards so best leave some small problem for hand of God to keep in check. )
Also ,start a rumour and cultivate a fear that the unseen hand of GOD will strike the woman who messes with another woman, period.
That should leave no room to manoeuvre for any hanky-panky on either side of the river bank.
So the rules of the game should be changed to :
No hetero, homo or tetra hanky-panky unless it has been blessed by the hand of God.
God bless you my people.
[ August 17, 2003: Message edited by: HS Thomas ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
posted by Jim Yingst:
Or, how does A know that nothing happened?


According to the problem statement, the women are unquestionably well-behaved. So stop thinking like a man and approach the problem like a woman would, Jim.
Note that it's the husbands who have a problem with jealousy.
regards
[ August 17, 2003: Message edited by: HS Thomas ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
According to the problem statement, the women are unquestionably well-behaved.
Note that it's the husbands who have a problem with jealousy.
The problem statement says nothing of the kind. It just says "due to bitter jealousy, no woman could be left with another man unless her husband was present." It doesn't say whose jealousy, or what exactly motivates it. Maybe the women are completely faithful, and it's just the men who imagine their wives being unfaithful. Or maybe the men are completely faithful, but the women imagine that their husbands are not. Or maybe no one is really faithful, but people nonetheless resent their mates being unfaithful even if they themselves are not. There are lots of possibilities here; no need to limit your thinking to the first interpretation that popped into mind.
Note also that when I said "Or, how does A know that nothing happened?" - that is completely consistent with your assumption that the wives are faithful and it's the husbands' jealousies that are the real problem. So I'm not really sure what you were objecting to anyway, but you're wrong.
[ August 17, 2003: Message edited by: Jim Yingst ]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
True.
Obviously, nothing is simple or straight-forward in the land of Peru.
Now wives and husbands have to be together at all times to prevent state of jealousy in either partner.
_________________________________________________________n n n
It is highly possible that the river is a bendy river.________________ U U U . Nothing is straight in this land.
So once A,Aw are across keep pointing boat in the opposite direction until it reaches the other bank. Keep doing this till all pairs have crossed together.Who's to say that the boat is not a motor boat ? The transfer will happen quicker.
Either way , everyone's across and not jealous.

regards
[ August 17, 2003: Message edited by: HS Thomas ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Nothing is straight in this land.

Well, that would open up a whole new set of complications.
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Well, A,Aw end up on the first loop, B,Bw on the second, and C,Cw on the 3rd loop.
That should straighten them out.
Of course, a course in Trust is now essential otherwise they are doomed to keep to separate paths from now on.
The question is what incident occurred on the other bank that drove them to fits of jealousy and suspicion in the first place? Obviously, everthing was alright in the state of Peru until they came to the river bank.
A,B or C are highly suspect of some sheenanighans to have led to this state of affairs. Ooops. If A had an affair with Bw but Cw suspects C with Aw, this could lead to a situation of tension as described. There is no evidence of B of doing anything untoward,; that's sufficient to put him high on the list of suspects.
What really happened on the other side of the bank ?
[ August 18, 2003: Message edited by: HS Thomas ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I got it!
Aw, Bw and Cw force their husbands to drink Peruvian rum until they all pass out. Then, one of the wives takes the others across. No fear of anything, except for messing up the boat...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
HS Thomas
Ranch Hand

Joined: May 15, 2002
Posts: 3404
Mr. Jim Yingst won't be too happy with that, either. Being of suspicious mind he'd wonder what the two wives were up to while hard-working wife was taking boat across.
Did B show illogical resistance to imbibing Peruvian rum? That would confirm his involvement in dark going ons on the other side of the bank.

Did hard-working wife eagerly volunteer for task to take passed-out bodies to the other side? A display of eagerness of large proportions would cause Mr. Jim Yingst to ponder aloud about her motivations. Or her guilt!
regards
[ August 18, 2003: Message edited by: HS Thomas ]
Vivek Kumar
Greenhorn

Joined: Sep 23, 2003
Posts: 9
Suppose we add to the problem the 6 people have just heard the howl of a cannibal , calling others of his tribes to help him (he alone can't take on 3 men, and perhaps equally strong 3 ladies :roll: ). Now, the imperative thing for the 6 is to cross the river, and forget the jealousy. This will ease the problem a lot .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cross the river
 
Similar Threads
Why did the Chicken cross the road ?
Place Association
Will you drink Coca Cola
Psychology Test
WA #1.....word association