⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usedcar.clp

📁 一个有关专家系统的CLISP 源代码
💻 CLP
📖 第 1 页 / 共 4 页
字号:
              (inspect the outside)
         =>
              (printout t " " crlf)
              (printout t "Is the engine full of oil?" crlf)
              (printout t " " crlf)
              (bind ?enoil (read))
              (assert (oil ?enoil)))


         (defrule vis21-5
              (inspect the outside)
              (options powers yes)
         =>
              (printout t " " crlf)
              (printout t "Is the steering system full of fluid?" crlf)
              (printout t " " crlf)
              (bind ?sterf (read))
              (assert (str ?sterf)))

         ; ENGINE VIS RULES
         ;---------------------------------------------------------


         (defrule vis22
              ?belts <- (blt ?belt)
              (test (eq ?belt yes))
         =>
              (assert (BELTS WORN))
              (retract ?belts))


         (defrule vis24
              ?hoses <- (hos ?hose)
              (test (eq ?hose yes))
         =>
              (assert (HOSES WORN))
              (retract ?hoses))


         (defrule vis26
              ?gasss <- (gas ?gaso)
              (test (eq ?gaso yes))
         =>
              (assert (FUEL SYSTEM LEAKING))
              (retract ?gasss))











         (defrule vis28
              ?radtr <- (rad ?radr)
              (test (eq ?radr no))
         =>
              (assert (POSSIBLE RADIATOR LEAK))
              (assert (WEAK RADIATOR FLUID))
              (assert (COOLING SYSTEM PROBLEM))
              (retract ?radtr))



         (defrule vis30
              ?trans <- (tny ?trany)
              (test (eq ?trany yes))
         =>
              (assert (MAJOR TRANSMISSION PROBLEM))
              (retract ?trans))


         (defrule vis33
              ?trnfl <- (tnf ?tranf)
              (test (eq ?tranf no))
         =>
              (assert (POSSIBLE TRANSMISSION LEAK))
              (retract ?trnfl))


         (defrule vis35
              ?break <- (bkf ?brakf)
              (test (eq ?brakf no))
         =>
              (assert (POSSIBLE BREAK SYSTEM LEAK))
              (assert (ADD BRAKE FLUID))
              (retract ?break))



         (defrule vis37
              ?engno <- (oil ?enoil)
              (test (eq ?enoil no))
         =>
              (assert (ENGINE OIL LEAK))
              (assert (NEED OIL))
              (retract ?engno))


         (defrule vis39
              ?steer <- (str ?sterf)
              (test (eq ?sterf no))
         =>
              (assert (STEERING SYSTEM LEAK))
              (retract ?steer))










         ;---------------------------------------------------------

         (defrule vis41
              (inspect the outside)
         =>
              (printout t " " crlf)
              (printout t "Bounce the corner of the car." crlf)
              (printout t "Does the car bounce more than twice?" crlf)
              (printout t " " crlf)
              (bind ?shock (read))
              (assert (shck ?shock)))


         (defrule vis42
              (inspect the outside)
         =>
              (printout t " " crlf)
              (printout t "Are either of the front tires worn" crlf)
              (printout t "unevenly or different from each other" crlf)
              (printout t " " crlf)
              (bind ?trwer (read))
              (assert (trwr ?trwer)))


         ;--------------------------------------------------------


         (defrule vis43
              ?shocks <- (shck ?shock)
              (test (eq ?shock yes))
         =>
              (assert (BAD SHOCKS))
              (retract ?shocks))


         (defrule vis45
              ?tires <- (trwr ?trwer)
              (test (eq ?trwer yes))
         =>
              (assert (UNEVEN TIRE WEAR))
              (retract ?tires))


         ;---------------------------------------------------------


         (defrule vis47
              (inspect the outside)
         =>
              (printout t " " crlf)
              (printout t "Is there any evidence of leaks" crlf)
              (printout t "under the car?" crlf)
              (printout t " " crlf)
              (bind ?leaks (read))








              (assert (lks ?leaks)))


         (defrule vis48
              (declare (salience -100))
              ?insp <- (inspect the outside)
         =>
              (printout t " " crlf)
              (printout t "Is the exhaust system of the car" crlf)
              (printout t "rusted through in any of the pipes?" crlf)
              (printout t " " crlf)
              (assert (inspect eng run))
              (bind ?pipes (read))
              (retract ?insp)
              (assert (pps ?pipes)))


         (defrule vis48-5
              (inspect the outside)
              (options yr ?year)
              (test (<= 1980 ?year))
         =>
              (printout t " " crlf)
              (printout t "Is the catalytic converter intact" crlf)
              (printout t "on the exhaust system?" crlf)
              (printout t " " crlf)
              (bind ?convert (read))
              (assert (cnvrt ?convert)))


         ;--------------------------------------------------------


         (defrule vis49
              ?leak <- (lks ?leaks)
              (test (eq ?leaks yes))
         =>
              (assert (SYSTEM IS LEAKING))
              (retract ?leak))



         (defrule vis51
              ?exhst <- (pps ?pipes)
              (test (eq ?pipes yes))
         =>
              (assert (EXHAUST RUSTED OUT))
              (retract ?exhst))


         (defrule vis53
              ?vertr <- (cnvrt ?convert)
              (test (eq ?convert no))
         =>








              (assert (CATALYTIC CONVERTER MISSING))
              (retract ?vertr))


         ;---------------------------------------------------------

         (defrule eng1
              (declare (salience 100))
              (inspect eng run)
         =>
              (bind ?count 0)
              (while (<= ?count 20)
                 (printout t " " crlf)
                 (bind ?count (+ ?count 1)))
              (printout t "               ")
              (printout t " ENGINE RUNNING INSPECTION" crlf)
              (printout t " " crlf)
              (printout t "In this phase of the inspection please")
              (printout t " set the brake and start the engine." crlf)
              (printout t " " crlf)
              (printout t "Assuming the engine starts, hit <cr>")
              (printout t " to start the check out" crlf)
              (bind ?answer (readline))
              (while (<= ?count 10)
                 (printout t " " crlf)
                 (bind ?count (+ ?count 1))))

         ;---------------------------------------------------------

         (defrule eng2
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Does the steering wheel jump when the" crlf)
              (printout t "car is first started?" crlf)
              (printout t " " crlf)
              (bind ?jump (read))
              (assert (swjump ?jump)))


         (defrule eng3
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Are there exhaust fumes in the car?" crlf)
              (printout t " " crlf)
              (bind ?fume (read))
              (assert (exhstf ?fume)))


         (defrule eng4
              (inspect eng run)
         =>
              (printout t " " crlf)








              (printout t "Are there any ticking noises from" crlf)
              (printout t "the engine?" crlf)
              (printout t " " crlf)
              (bind ?tick (read))
              (assert (noiset ?tick)))



         (defrule eng5
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Are there any clunking noises from" crlf)
              (printout t "the engine?" crlf)
              (printout t " " crlf)
              (bind ?clnk (read))
              (assert (noisec ?clnk)))



         (defrule eng6
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Do all the gauges or lights show" crlf)
              (printout t "normal engine operation?" crlf)
              (printout t " " crlf)
              (bind ?gage (read))
              (assert (gauges ?gage)))


         (defrule eng6-5
              (inspect eng run)
              (options dhgages yes)
         =>
              (printout t " " crlf)
              (printout t "When the car is first started, does" crlf)
              (printout t "engine temp gauge show a warm engine" crlf)
              (printout t " " crlf)
              (bind ?warm (read))
              (assert (wrmeng ?warm)))



         (defrule eng7
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Do the headlights work?         " crlf)
              (printout t " " crlf)
              (bind ?hlgt (read))
              (assert (hdhght ?hlgt)))










         (defrule eng8
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Do the breaklights work?         " crlf)
              (printout t " " crlf)
              (bind ?blgt (read))
              (assert (bkhght ?blgt)))


         (defrule eng9
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Do the turnsignals work?         " crlf)
              (printout t " " crlf)
              (bind ?tnsl (read))
              (assert (trnsig ?tnsl)))



         (defrule eng10
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Pump the brakes and hold them.   " crlf)
              (printout t "Do the brakes sink to the floor?" crlf)
              (printout t " " crlf)
              (bind ?sink (read))
              (assert (bksink ?sink)))


         (defrule eng11
              (inspect eng run)
              (options tran no)
         =>
              (printout t " " crlf)
              (printout t "Press the clutch pedal.          " crlf)
              (printout t "Is there a grinding or clatter?" crlf)
              (printout t " " crlf)
              (bind ?clgr (read))
              (assert (clgrnd ?clgr)))


         (defrule eng12
              (inspect eng run)
              (options tran no)
         =>
              (printout t " " crlf)
              (printout t "Set the parking brake. Shift to 1st" crlf)
              (printout t "gear. Rev the engine SLIGHTLY and let" crlf)
              (printout t "out the clutch. Does the engine stall?" crlf)
              (printout t " " crlf)
              (bind ?stall (read))








              (assert (clstall ?stall)))


         (defrule eng13
              (inspect eng run)
         =>
              (printout t " " crlf)
              (printout t "Is the engine running rough?   " crlf)
              (printout t " " crlf)
              (bind ?rogh (read))
              (assert (rough ?rogh)))



         (defrule eng14

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -