The farmers puzzle for the chicken, fox and corn..!!

M

mehul

Dear all..

I am trying to find a way to graphically represent the following
puzzle... I will really appreciate it, if I can be provided with a JAVA
code for the following:

Farmer, chicken,fox and corn are one side of the river. They have a
boat on which at one time only one other person can ride along with the
farmer and cross the river.

However, the problem lies in the following:

If the farmer leaves the chicken and the fox together, fox eats the
chicken.
If the farmer leaves the chicken and the corn togethet, chcken eats the
corn.

I think loops,boolean and conditional statements would do the job.

Thanks a lot..

Mehul
 
D

Daniel Dyer

Dear all..

I am trying to find a way to graphically represent the following
puzzle... I will really appreciate it, if I can be provided with a JAVA
code for the following:

Farmer, chicken,fox and corn are one side of the river. They have a
boat on which at one time only one other person can ride along with the
farmer and cross the river.

However, the problem lies in the following:

If the farmer leaves the chicken and the fox together, fox eats the
chicken.
If the farmer leaves the chicken and the corn togethet, chcken eats the
corn.

I think loops,boolean and conditional statements would do the job.

Thanks a lot..

Sure, and if you give me your Imperial College student number I'll even
submit it for you to save you the effort.

Dan.
 
W

Wil Hadden

mehul said:
Dear all..

I am trying to find a way to graphically represent the following
puzzle... I will really appreciate it, if I can be provided with a JAVA
code for the following:

Farmer, chicken,fox and corn are one side of the river. They have a
boat on which at one time only one other person can ride along with the
farmer and cross the river.

However, the problem lies in the following:

If the farmer leaves the chicken and the fox together, fox eats the
chicken.
If the farmer leaves the chicken and the corn togethet, chcken eats the
corn.

I think loops,boolean and conditional statements would do the job.

Thanks a lot..

Mehul

In the logical set of all possible programs, the number of ways that problem
can be solved is enormous.

I can see in this set that your assertion of using loops, booleans and
conditional statments to be true, even to the extent that these mechanisms
are in some programs that use them extensively while not using any of them
to specifically solve or demonstrate the Farmer puzzle.

Top marks.
 
M

mehul

Dont worry this aint a coursework....

Just got a new book in JAVA for self study..

Thanks anyway..
 
T

TechBookReport

Daniel said:
Sure, and if you give me your Imperial College student number I'll even
submit it for you to save you the effort.

Dan.
He'll go far, obviously. He's posted questions and requests for help in
lots of news groups, without ever posting any work that he's done or
indicating that he's done any work at all.

I wonder if his lecturers ever look at these groups?
 
E

Eike Preuss

Dont worry this aint a coursework....

Just got a new book in JAVA for self study..

The one thing essential to self study is to do your exercises yourself...
 
O

Oliver Wong

Since you're trying to represent the puzzle graphically, you might need
JPanel, Graphics2D, inheritance, threading, events, MouseListeners, layout
managers and class loaders too (among several other things).

It sounds like you're just starting out. If so, I recommend you lay off
the graphics at first and concentrate more on the logic of getting the
program to give the correct answer (in textual form). Once you've got that
figured out, you can start worrying about GUIs.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top