专家系统剪辑代码返回false值

时间:2015-12-05 21:14:06

标签: clips

我有一个诊断某种疾病的专家系统。

它是用剪辑编码的。但是这段代码并没有在剪辑中运行,并且在运行结束时返回false语句。我一遍又一遍地追踪它,但我没有注意到问题所在。

以下是我的代码的一部分: 请帮我。 真诚。

`(deffacts init (start)) `
'(Defining defrule mainmenu '
'(start) '
'?ml <- (start) '
'=> '
'(printout t crlf crlf crlf crlf crlf crlf)'
'(printout t '
'"an expert system for diagnosis of some skin '
'disease" crlf crlf'
'"               Main Menu" crlf'
'"                ==========crlf crlf crlf'
'"         1-Skin rashes without fever" crlf crlf'
'"         2- Skin rashes with fever" crlf crlf'
'"         3- Skin infection " crlf crlf crlf'
'"         0- Quit the program " crlf crlf'
'"Type number of your choice then hit return key" crlf crlf'
'" Choice: ")'
'(bind ?response (read))'
'(if (eq ?response 1)'
'then (assert (type 0-1))'
'else'
'(if (eq ?response 2) then (assert (type 0-2)))'
'else '
'(if (eq ?response 3) then (assert (type 0-3)))'
'else'
'(if (eq ?response 0) then (assert (type quit)))'
'(printout t crlf)'
'(retract ?ml))'
'(Defining defrule user-quits'
'(type quit)'
'=>'
'(printout t "you have QUIT the program." crlf)'
'(halt))'
'((Defining defrule without'
'?p <- (type 0-1)'
'=>'
'(printout t crlf crlf crlf)'
'(retract ?p)'
'"printout t'
'"      Diagnosis of some skin desease " crlf crlf crlf'
'"      Skin rashes without fever menu" crlf'
'"      ==================================" crlf'
'crlf'
'"      1- red patches of skin , painful joints, " crlf'
'"         pitted nails, poorly controlled dandruff" crlf'
'crlf'

1 个答案:

答案 0 :(得分:0)

CLIPS> (deffacts init (start)) 
CLIPS> 
(defrule mainmenu 
   ?ml <- (start) 
   => 
   (printout t crlf crlf crlf crlf crlf crlf)
   (printout t 
    "an expert system for diagnosis of some skin disease" crlf crlf
    "               Main Menu" crlf
    "               =========" crlf crlf crlf
    "         1- Skin rashes without fever" crlf crlf
    "         2- Skin rashes with fever" crlf crlf
    "         3- Skin infection " crlf crlf crlf
    "         0- Quit the program " crlf crlf
    "Type number of your choice then hit return key" crlf crlf
    " Choice: ")
   (bind ?response (read))
   (switch ?response
      (case 1 then (assert (type 0-1)))
      (case 2 then (assert (type 0-2)))
      (case 3 then (assert (type 0-3)))
      (case 0 then (assert (type quit))))
   (printout t crlf)
   (retract ?ml)))
CLIPS> 
(defrule user-quits
   (type quit)
   =>
   (printout t "you have QUIT the program." crlf)
   (halt))
CLIPS> (reset)
CLIPS> (run)






an expert system for diagnosis of some skin disease

               Main Menu
               =========


         1- Skin rashes without fever

         2- Skin rashes with fever

         3- Skin infection 


         0- Quit the program 

Type number of your choice then hit return key

 Choice: 0

you have QUIT the program.
CLIPS>