12.07.2015 Views

flex Examples - LPIS

flex Examples - LPIS

flex Examples - LPIS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

28 Flex Example Listingsquestion confirm_passwordPlease confirm the password you just entered;input X such that confirm_password(X) ;because the answer must be the same as the password you entered earlier .% This relation checks that a given response is equivalent to the answer% to the password question.relation confirm_password( P )if P is equal to the answer to password .relation confirm_password( P )if echo( P, 'is not the correct password' )and fail ./*The ask_all_questions/0 action writes the answer to all the questionscurrently defined in the <strong>flex</strong> system.The isa_question/4 predicate can be used to find all the currentlydefined questions.*/The "$" sign shows that the value of N is not to be de-referenced. Inthis case we want to write out the name of the question and not itsanswer.action ask_all_questions ;for every isa_question(N,_,_,_)do write( $ N )and write( ' is ' )and writeq( the answer to N )and nlend for .% The catchall question can be used to catch any undefined question.question catchallThis question catches any undefined question.Please input some text;input name .ROBBIE.KSL Listing/*Robbie the Robot Example - Phil Vasey=====================================This example demonstrates the use of forward-chaining in aconfiguration and resource allocation problem.Description-----------This example implements a shopping expert system. The problem is inthree distinct stages:A Guide to the Flex Expert System Toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!