This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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
Author

Wolf, Goat and Cabbage problem solution

ozg yeal
Greenhorn

Joined: Dec 10, 2004
Posts: 9
Hi
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.

Thanks
Ulf Dittmer
Rancher

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

Let's continue the discussion in this duplicate thread.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Wolf, Goat and Cabbage problem solution
 
It's not a secret anymore!