Assignment - Cooking
The task is to create a simple decision support system for cooking.
Predicate in the database has the following syntax:
at_home ([ingredient (rice, 2), ingredient (water, 10)]).
The predicate at_home, so is
rice ingredient and 2 represent the amount of rice available at home.
Recipe (boiled_rice, [ingredient (rice, 4), ingredient (salt, 3), ingredient (water, 5)]).
recipe (chicken, [ingredient (chicken, 2), ingredient (salt, 1), ingredient (pepper, 1)]).
The predicate recipe, so is rice (or chicken) dish and the second argument is a list of ingredients needed to cook the dish.
After defining the database (and added some recipes), you will write two predicates:
First Cook (X) provides an answer to what can be repaired by the ingredients available at home.
The question can also be "Can I cook dish X". Responses should be the various options available to cook.
Second buy (X, L), the quantities of different ingredients that must be purchased in order to cook the dish x.
The program shall gather Required ingredients and quantities in the list L. The question must also be able to buy (X, L). which shall enumerate (with ';') all known recipes and what needs to be purchased in order to cook them.
A possible solution to buy (Rice, L), from the above example, can be: L = [ingredient (rice, 2), ingredient (salt, 3)]
It is appropriate to break down and preached in the sub-tasks as using predicates can take care of. Examples of such may be (but there are more ways to divide the problem): at_home (Type, Amount): talking about how much it is home of the ingredient type. need_to_buy (Needed, BuyList): creates a shopping list (BuyList) given a list of the essential ingredients (Needed). Since both the cook and buy to enumerate solutions should be the declarative predicate
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.