Header Montage

Prolog project

This project is due on March 20 (the same day as the final).

Turn in the project by sending an email to ljosa@cs.ucsb.edu. Please abide by the following conventions:

You are to write all of your code yourself. Cutting and pasting from files you find on the web will be considered cheating.

Problem statement

You are to help plan a three-course meal for the Department of Computer Science holiday party. The students and faculty are from many different countries, and the chef would like to make the meal truly international: The three courses (an appetizer, an entree, and a dessert) must come from different countries. In addition, the following rules apply:

  1. The meal must include either a Chinese or Egyptian dish.
  2. If an Indian appetizer is chosen, a Korean dessert must be chosen.
  3. If an American dish is chosen, no Mexican dish may be served.
  4. If a Vietnamese dish is chosen, the Entree must be Chinese.
  5. A Korean dish may not be served before an Egyptian dish.
  6. The appetizer can not be Chinese.
  7. Egyptian and Vietnamese food are not safe together.
  8. Of all the American dishes only desserts are worth eating.
  9. Indian food is best with a Korean appetizer. This additionally implies that Indian food cannot be an appetizer.
  10. Mexican desserts are not that great.
  11. If Korean and Chinese food are served together, the entree had better be Korean.
  12. A Mexican entree and Egyptian food are best followed by Korean dessert. This means: A Mexican entree, when served with Egyptian appetizer, needs a Korean dessert.
  13. Chinese and American food must have an Indian appetizer. This means that if Chinese and American foods are served together, then they need an Indian appetizer.
  14. A Mexican appetizer must have a Korean dessert.
  15. American food must be served with a Chinese entree. This means that American food is served if and only if a Chinese entree is served. (There is a double implication here: Chinese entree implies some American food, and American food implies Chinese entree.)

Please help the chef plan this meal by providing a Prolog function meal(A,E,D) which returns all possible solutions to this problem. (There are three solutions.) It might be a good idea to break this problem into a set of clauses, and test each clause separately. This is much easier than trying to write one monster statement.

The predicte meal(A,E,D) will yield "Yes" if given a correct set of meal choices, and "No" for a set that is either not deducible or not correct.

Tips

Prolog Quick Start

See the lecture notes.

Attend prolog discussion sections.

Come to the TA's or instructor's office hours if you get stuck.

 
XHTML Validation | CSS Validation
Updated 2007-04-24
Questions should be directed to Vebjorn Ljosa