aspose file tools*
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
Marshal

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

Let's continue the discussion in this duplicate thread.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wolf, Goat and Cabbage problem solution