(defrule startuj ?x <- (initial-fact) => (assert (start)) (retract ?x) (printout t "Diagnostyka" crlf)) (defrule starter ?x <- (start) (not (starter ?)) => (retract ?x) (printout t "Starter working (y/n)?") (assert (starter (read)))) (defrule petrol-no ?x <- (starter y) ?y <- (petrol n) => (printout t "Buy petrol" crlf) (retract ?x ?y) (assert (initial-fact))) (defrule petrol-yes ?x <- (starter y) ?y <- (petrol y) => (printout t "Call AA" crlf) (retract ?x ?y) (assert (initial-fact))) (defrule petrol (starter y) (not (petrol ?)) => (printout t "Got petrol (y/n)?") (assert (petrol (read)))) (defrule lights (starter n) (not (lights ?)) => (printout t "Lights working? (y/n)" crlf) (assert (lights (read)))) (defrule battery ?x <- (starter n) ?y <- (lights n) => (printout t "Charge battery" crlf) (retract ?x ?y) (assert (initial-fact)))