jQuery in Action, 3rd edition
The moose likes Game Development and the fly likes Wolf, Goat and Cabbage problem solution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Wolf, Goat and Cabbage problem solution" Watch "Wolf, Goat and Cabbage problem solution" New topic

Wolf, Goat and Cabbage problem solution

ozg yeal

Joined: Dec 10, 2004
Posts: 9
The problem is :

A farmer with his wolf, goat and cabbage come to the edge of a river they wish to cross. There is a boat at the river�s edge. But, of course, only the farmer can row it. The boat also can carry only two things (including the rower) at a time. If the wolf is ever left alone with the goat, the wolf will eat the goat; similarly, if the goat is left alone with the cabbage, the goat will eat the cabbage. Devise a sequence of crossings of the river so that all four characters arrive safely on the other side of the river.

I need java code which finds a solution to this problem.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
Please do not post the same question to multiple forums: CarefullyChooseOneForum

Let's continue the discussion in this duplicate thread.
Don't get me started about those stupid light bulbs.
subject: Wolf, Goat and Cabbage problem solution
It's not a secret anymore!