2.6.3 Editing Rule Definitions

Figure 2.10 KnowledgeWorks Editor

Let us suppose that when the demo finishes we would like it to ask if we want to play again. Find the definition for GAME-FINISHED (using the Rule Browser). One line in the definition is commented out with a ; (semi-colon) at the start. Remove the semi-colon and compile the new definition by choosing Definitions > Compile from the editor menu bar. Press Space to return to the editor view. This rule will now ask if the user wants to play again and execution will only stop (the (return) instruction ends execution) if requested. Run the demo to see this happen.

The rule FETCH-NEW-ANIMAL also has a commented-out line (repeat) which will make it repeat its prompt until given an animal it does not already know. Remove the semi-colon at the start of the line in and compile the new definition of the rule. Run the demo again and try giving the system an animal it recognizes. It will prompt again. Give it an animal it does not recognize to finish.

KnowledgeWorks and Prolog User Guide (Macintosh version) - 11 Jul 2006