Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 596
  • Last Modified:

puzzle questions

A man (M), wolf (W), goat (G) and cabbage (C) are on the left bank of a river. There is a boat large enough to carry
the man and only one of the other three. The man wishes to ferry everyone to the right river bank, and the man can
ferry each across, one at a time.
However, if the man leaves the wolf and goat unattended on either shore, the goat is history. Similarly the goat and
cabbage cannot be left unattended by the man.

How can the man bring all those animals to the other river bank safely using the shortest way possible?
0
kuntilanak
Asked:
kuntilanak
1 Solution
 
sunnycoderCommented:
Hello kuntilanak,

man take goat
comes back
takes wolf
brings goat back
take cabbage
comes back
takes goat

Regards,

sunnycoder
0
 
kuntilanakAuthor Commented:
hey it's you again, thanks for helping since you're quite familiar with dfa/nfa.. I want to practice and put this into a transition diagram.

The start state is labeled MWGC | 0

0 = empty set

and input set will be soemthing like:

g (rows across with the goat), c (rows accross with the cabbage)

example when given an input gm

MWGC|0 -> WC|MG -> MWC|G

Any hints?

0
 
sunnycoderCommented:
>example when given an input gm
>MWGC|0 -> WC|MG -> MWC|G
>Any hints?
You drew first three states correctly ... translate rest of the steps into your state diagram
0
New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

 
ozoCommented:
MWGC|0 -> WC|MG -> MWC|G -> W|MCG -> MW|MGC -> 0|MWCG
0
 
sunnycoderCommented:
>MW|MGC
Thats does not look correct ... man cant be in two places at one time

MWGC|0 -> WC|MG -> MWC|G -> C|MWG -> MGC|W -> G|MWC -> MG|WC -> 0|MWGC
0
 
kuntilanakAuthor Commented:
so there's 6 states in this problem, and I just draw 6 circles with arrows connecting to each (input) other?
0
 
kuntilanakAuthor Commented:
oh and I just realized that ozo's solution has a shorter path :)
0
 
Rob HutchinsonDesktop SupportCommented:
Actually, there is an easier solution. Just use a tranquilizer gun on both the goat and the wolf, then take them over one at a time...faster too.
0
 
kuntilanakAuthor Commented:
haha..yea, that's a killers solution.. oh and if I were asked to draw a transition diagram of this situation.. what would it be like?
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now