Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1.  Consider the condition that needs to be true succeed when you generate this page (Hint: look at the start page rule body and how the first parameter of the page/3 predicate is used in that rule).

  2. Think about what you want to be on this page. It needs somewhere to show text to introduce your agent. For this, you can use a card or an alert, for example. This will be the first atom in your HTML code that we use in Step 3. The second atom should be HTML code with text(formatted) to introduce your bot agent, i.e. what you want to go on your alert or card. This atom needs to be able to add a variable later (the bot’s bot's name) read the Visual Support: A Guide for hints on how to do that.

  3. Use a predicate to combine the first atom and second atom you created in the previous step (check out the Visuals Guide for how to do this). What we created in HTML above is our template, thus the predicate should return the variable Template.

  4. Now we need to get the botagent's name in order to add it to our text. This knowledge should be somewhere in the agent's memory. Hint: Look at line 40 in dialog_init for the applicable predicate. Save Retrieve the name of the bot as agent in a variable.

  5. Next, you should use the applyTemplate/3 predicate to add the bot’s agent’s name to our HTML code atom (which is also detailed explained in the Visual Support Guide).

  6. Lastly, you should take use the variable returned from applyTemplate last variable that you used in the applyTemplate/3 predicate and use the html/2 predicate to convert your code snippet into a completed HTML page. This can be done by using html(YourCompleteHTMLCodeVariableHere, Html). Html is the variable returned by that returns the page function as you can see in the head of the rule.

...

  1. Make sure this page is shown at the right time.

  2. Retrieve the following information by putting the appropriate predicates in the places indicated in the rule by comments and by using the variable names indicated below.

    1. We need to retrieve the chosen recipe from memory. Find the necessary predicate and name that variable Recipe.

    2. The previous step retrieves the Recipe ID, but we also need the recipe name. Use a variable called Name for this.

    3. Retrieve the time needed to complete the recipe in a variable named Minutes.

    4. Retrieve the number of servings in a variable called Persons.

  3. To retrieve a list of the recipe steps and a list of ingredients, you will need to implement two additional predicates need to be implementedin recipe_selection.pl. The predicates that we need to implement can be found in the recipe_selection.pl file and are labeled with the comment %For Visual Support to-do

    1. This first is a rule that returns a list of ingredients ingredients(RecipeID, IngredientList) :-

      1. Find a built-in Prolog predicate (part of the Prolog language) that you can use for returning a set of ingredients that fit a specific goal

      . Use this predicate to specify the ingredient rule.For
      1. (i.e. the recipe we are looking at). This predicate should take (a list, check elements in list for compliance with a condition(goal of filtering), then return a list of the

      2. Now that we have found the necessary predicate we need to define the “goal”, i.e. the condition an ingredient has to fulfill to be added to the set. We only want ingredients for a recipe with a certain RecipeID. In the database find the predicate that is used to store ingredient information. With this ingredient information predicate we will define our condition in our set predicate For this rule ingredients use the function from above and to simplify your goal you can use the caret(^) by defining your goal with the following syntax:

RecipeID^(predicate with information(RecipeID, Information))

...