Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solve logic puzzle with Prolog..help!

16 views
Skip to first unread message

lisa.hu...@gmail.com

unread,
Apr 23, 2015, 10:53:37 AM4/23/15
to
So here's the logic puzzle that we are required to solve. I need to write a program in Prolog that solves this puzzle, not simply prints the answer. I have no idea where to start...could anyone give me some pointers or help me write the code? Please and thank you!


With spring in the air, everyone's starting to think about spring clean-up so Jeff spent all week after school and all weekend doing odd jobs around the neighborhood to earn some spending money. He tilled gardens, raked leaves, cleaned up tree limbs, pruned hedges, and even spent one afternoon babysitting! Each day he worked for a different neighbor on a different chore. He charged each neighbor a reasonable rate for his work, but sometimes he got tips too. By the end of the week, he was quite pleased with the amount that he'd earned and each of the neighbors was pleased with the quality of work that he'd done. Determine the last name of each neighbor, what chore Jeff completed for each neighbor, what day of the week Jeff worked for each neighbor, how long each task took him (2 to 4 hours), and how much he earned for each task ($20 to $36).

1. Jeff helped Mrs. Agnew till her garden but it didn't take him 4 hours. Mr. Summer didn't need help on Thursday.

2. He spent an extra hour working on Thursday than he did on Wednesday but he wasn't pruning hedges on either day.

3. On Sunday, he earned $8 more than he did when the day he was babysitting, which earned him $4 more than he earned from Mr. Compton.

4. Jeff made $20 from the job he spent 2 hours doing, which wasn't removing tree limbs.

5. Mr. Numen, who didn't ask him to rake leaves, paid him $32 but it didn't take him 3 hours. The job on Friday for Mrs. Fields took less time than the garden tilling job.

6. The hedge pruning job took him 3-1/2 hours to complete, a half hour longer than the job he did on Thursday. Jeff made $36 from the job he spent 4 hours doing, which was on Saturday.

lisa.hu...@gmail.com

unread,
Apr 23, 2015, 10:56:55 AM4/23/15
to

Here's a link to the logic puzzle that solves it with a grid to give you a better look at the problem:
http://www.puzzlersparadise.com/onlinelogic/SpringtimeOddJobs.htm
0 new messages