; Run (in CLIPS command line): ; (clear) ; (load soup.clp) ; (set-fact-duplication TRUE) ; (set-strategy breadth) ; (reset) ; (run) (deffacts initial-facts-set (chicken 2) ; kilogram (potatoes 3) ; kilogram (salt 100) ; gram ) (defrule process-soup (declare (salience 10)) ?f1 <- (processed-salt) ?f2 <- (processed-chicken) ?f3 <- (processed-potatoes) => (retract ?f1 ?f2 ?f3) (assert (soup)) (printout t "Soup finished!" crlf) (halt) ) (defrule process-salt ?f1 <- (salt ?amount) (test (>= ?amount 10)) => (bind ?new-amount (- ?amount 10)) (printout t "Salt: " ?amount " => " ?new-amount crlf) (retract ?f1) (assert (salt ?new-amount) (processed-salt) ) ) (defrule process-chicken ?f1 <- (chicken ?amount) (test (>= ?amount 1)) => (bind ?new-amount (- ?amount 1)) (printout t "Chicken " ?amount " => " ?new-amount crlf) (retract ?f1) (assert (chicken ?new-amount) (processed-chicken) ) ) (defrule process-potatoes ?f1 <- (potatoes ?amount) (test (>= ?amount 1)) => (bind ?new-amount (- ?amount 1)) (printout t "Potatoes " ?amount " => " ?new-amount crlf) (retract ?f1) (assert (potatoes ?new-amount) (processed-potatoes) ) )