-2

I want to do a guide for a student who want to register in a college, knowing his statues, or anything related t a college system..

First < ask question which question type he want to ask "Foundation|diploma level|advance diploma|bachelor... then, id choice 1> ask: are you registered in "college Name? (yes/no)"

if yes > assert another question, No> print some advice, then go to another
. . some questions needs to get user input from a given choices .. "how do it" "which level in diploma?" level1/level2/level3/level4

. . It is just like a guide program....

raya ali
  • 3
  • 1
  • 4

1 Answers1

0

Your rule is missing a close right parenthesis. If you add it, you can get the rule to reactivate itself when you select level4.

CLIPS> (assert (case14))
<Fact-1>
CLIPS> (agenda)
0      choice4: f-1
For a total of 1 activation.
CLIPS> (watch facts)
CLIPS> (run)
<== f-1     (case14)
Which level in diploma of IS (level1 ,level2, level3, level4)?level4
==> f-2     (case14)
<== f-2     (case14)
Which level in diploma of IS (level1 ,level2, level3, level4)?level4
==> f-3     (case14)
<== f-3     (case14)
Which level in diploma of IS (level1 ,level2, level3, level4)?level3
==> f-4     (case15)
CLIPS>
Gary Riley
  • 10,130
  • 2
  • 19
  • 34
  • Thank u Gary, but which code I have to add?.. how is the final code should be... Have I copy all your code?...... – raya ali Apr 05 '15 at 08:46
  • Add a ')' to the end of choice4. – Gary Riley Apr 05 '15 at 16:48
  • Posting a listing of exactly what you tried would go a long way toward solving your problem. – Gary Riley Apr 06 '15 at 14:39
  • (defrule choice4) ?f <- (case14) => (retract ?f) (bind ?response (ask-question "Which level in diploma of IS -level1 ,level2, level3, level4-?" level1 level2 level3 level4)) (if (eq ?response level1) then (assert (case15)) else (if (eq ?response level2) then (assert (case16)) else (if (eq ?response level3) then (assert (case17)) else (assert (case18)) ))) ................................................................... I add right parenthesis,, nothing change – raya ali Apr 08 '15 at 10:00
  • Rather than adding a closing right parentheses at the end of the rule, you added one after the rule name. – Gary Riley Apr 08 '15 at 18:56
  • Mr. Gary, it still dosnt work - when I want to add the fourth choice, program does not execute ........ my new syntax (defrule rule3 "" (working-state engine unsatisfactory) (line3) (not (repair ?)) => (bind ?response (read)) (ask-question "Which level / 1,2,3,4 ? ") (if (eq ?response 4) then (assert (line5)) else (if (eq ?response 1) then (assert (repair "ok1")) else (assert (repair "okk")) ))) ................................. id i add new "else if" it does not function .... please neeed help – raya ali May 17 '15 at 09:29
  • You tried something and it didn't work. Without showing specifically what you did and the results you got, it's pretty hard to figure out how to correct your error. Assuming that the ask-question deffunction is defined, there's nothing syntactically wrong with your rule. If the ask-question call is deleted from your rule and the (working-state engine unsatisfactory) and (line3) facts are asserted, the rule works appropriately for responses of 1, 4, and other values. – Gary Riley May 17 '15 at 16:58
  • Gary, Iam no professional in clips programming., so please understand :( I said to u i will send it by email to attach all code so you can figure out the problem ...... I am really thankful to u :) – raya ali May 18 '15 at 03:26
  • maybe it will be better to us "while statement" than if statement ? – raya ali May 18 '15 at 03:30