From UBC Wiki

Recipe Suggester

Authors: Ruth Lin, Heuven Lam

What is the problem?

It is often times easy to succumb to the cheap thrills of fast food being a student living away from home. However, fast food doesn't provide the necessary nutritional benefits a well balanced meal does and the costs eventually add up. Cooking your own meal in you dorm can seem like a complicated and daunting task - but fear not, RecipeSuggester is here to the rescue! RecipeSuggester is an application that intakes a list of ingredients a user has in their pantry/fridge and outputs the possible dish they can make after taking into account their dietary restrictions and cultural preferences! RecipeSuggester's knowledge base and domain will be limited to the ingredients a typical college student is likely to have and inspired from the recipes of breadedfishstrip's popular poor student cookbook at

What is something extra?

In addition to providing the possible dish an user can make, RecipeSuggester will also generate a text file incorporating the recipe of each dish in their folder they are running the program in.

What did we learn from doing this?

We learned that it was necessary to constrain our domain as initially we were rather vague as to the amount of ingredients and recipes we would include in our app. By constraining our domain, we had a concrete idea about all the edge cases and possible facts we would define in our knowledge base so that as long as an user answered with a valid input (list of ingredients []), we would always give them back either a dish or a prompt as to why their ingredients and conditions did not map to any valid dish in our repertoire. We also learned how to design a simple Q/A answer that utilizes Prolog's natural chaining of facts we receive as input from an user to work through inference and deduce exactly the final possible list of ingredients we can utilize to map to a dish. For example, a user could have [rice,eggs,beef] but wanting to make a vegetarian meal for that day, and thus our system would filter out their list to [rice,eggs] and eventually map it to omurice. We also achieved our "something extra" by creating a recipe text file, opening a stream to it, and mapping the recipe and cost of the determined dish to that particular text file in the same directory the application was being run from.

Prolog was an excellent fit for our program's task of filtering a list of ingredients to map to a single dish since it is based on matching rules at each step to satisfy each declared requirement from a user. After our knowledge base was built, it was incredibly easy to debug and see where the user's queries were being matched incorrectly through backtracking.