if we are going to relax the assumption that the boat has to be full, i
have a really easy solution:
have everyone cross by themselves.
and, as people are (i hope) noticing, you can run into this problem BEFORE
the last boat.
On Thu, 22 Feb 2001, Alexandra Fedorova wrote:
I don't know if my solution could be considered
elegant, but I think it's
practical: basically I make sure that everyone gets to the other side,
even if at the end the boat has to be rowed with fewer than 3 people.
I let anyone jump on the boat as long as the combination of
people on the boat is valid. If it is not, they would have to wait. The
people who are already on the boat have to wait till the boat gets full,
unless there are no more people on the shore who could get in the boat
without violating the rules. For example, if two cannibals are on the
boat, and only one person left on the bank, who turns out to be a
missionary, he does not get on the boat, and cannibals take off. Then, on
the next turn missionary gets on the boat, and since he is the only one
left, he rows over alone.
On Thu, 22 Feb 2001, gwa wrote:
yo, i'm mad frustrated with cannibals.
is there anyone who has an elegant solution and would like to share?
-gwa-
_______________________________________________
cs161-list mailing list
cs161-list(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/cs161-list
_______________________________________________
cs161-list mailing list
cs161-list(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/cs161-list