Download Herbal Tutorial v3.1c - Applied Cognitive Science Lab
Transcript
A Gentle Introduction to Herbal 4.7 12 Creating Conditions For Sally to achieve her goal of survival, there are two specific conditions that she needs to look out for: hunger and thirst. These conditions are indicated by the presence of a fact of data type Person with a hungry field of true and/or a thirsty field of true. To create these conditions, follow these steps: 1. Select the Conditions tab inside the Herbal GUI Editor. 2. Click on the New button located next to the list of existing conditions. 3. Accept the default value given in the Library field. 4. Enter isHungry for the name of the condition and click Finish. 5. Repeat steps 1-4 to create an additional condition name isThirsty. 6. Each condition should contain one or more clauses that must all be true for the condition to be true. To add clauses to the isHungry and isThirsty conditions, follow these steps: 7. Select the isHungry condition in the list of existing conditions. 8. Click on the Add button located next to the list of current clauses. 9. Choose the data type that you want to use in the clause. In this case, you want to see if an instance of the Person data type exists in working memory with its hungry field equal to true. As a result, select the Person data type, but do not click Next yet. 10. If the clause being created happens to successfully match an instance of the Person data type, it is helpful to give that instance a name so that it can be used later on in an action. For example, if we find an instance of the Person data type with a true hungry field, we need to set that field to false after Sally eats. To give the matching instance a name, enter hungryPerson into the Output Variable Name field in the dialog, and click Next. 11. Select the hungry field and then click on the Restrict button. 12. The next window allows you to specify the conditions upon which you will restrict the hungry field. In this case, you want to restrict the value to be equal to true. To accomplish this, select = from the list of Relational Operators and type true in the Literal field. 13. Click Finish and click Finish again.