(defrule start (initial-fact) => (printout t "What is the problem (wont-start/hesitates-high-speed)? ") (assert (problem (read)))) (defrule wont-start (problem wont-start) => (assert (task test-cranking-system))) (defrule hesitates-high-speed (problem hesitates-high-speed) => (assert (task test-fuel-system))) (defrule test-cranking (task test-cranking-system) => (printout t "Does the engine turn (yes/no/slowly)? ") (assert (engine-turns (read)))) (defrule crank-sys-defect ?t <- (task test-cranking-system) (engine-turns slowly|no) => (assert (defective cranking-system)) (retract ?t) (assert (task test-batt-conn))) (defrule crank-sys-good ?t <- (task test-cranking-system) (engine-turns normally|yes) => (assert (good cranking-system)) (retract ?t) (assert (task test-ign-sys))) (defrule test-batt-con ?t <- (task test-batt-conn) => (printout t "What is the result of the screwdriver test (off/brighten/dont)? ") (assert (s-test (read)))) (defrule batt-conn-bad (task test-batt-conn) (s-test brighten|off) => (printout t "The problem is a bad battery connection" crlf)) (defrule batt-conn-good ?t <- (task test-batt-conn) (s-test dont) => (assert (good battery-connection)) (retract ?t) (assert (task test-battery)))