You are on page 1of 3

(deftemplate AparatDeCafea (slot monede)(slot pret))

(assert (AparatDeCafea(monede nil)(pret nil)))


(defrule r0
(AparatDeCafea(monede nil)(pret nil))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 0 banuti")(pret ?r))))
(defrule r1
(AparatDeCafea (monede "Avem 0 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 5 banuti")(pret ?r))))
(defrule r2
(AparatDeCafea (monede "Avem 0 banuti")(pret Q))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 25 banuti")(pret ?r))))
(defrule r3
(AparatDeCafea (monede "Avem 5 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 10 banuti")(pret ?r))))
(defrule r4
(AparatDeCafea (monede "Avem 5 banuti")(pret Q))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 30 banuti")(pret ?r))))
(defrule r5
(AparatDeCafea (monede "Avem 10 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 15 banuti")(pret ?r))))
(defrule r6
(AparatDeCafea (monede "Avem 10 banuti")(pret Q))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 35 banuti")(pret ?r))))
(defrule r7
(AparatDeCafea (monede "Avem 15 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 20 banuti")(pret ?r))))

(defrule r8
(AparatDeCafea (monede "Avem 15 banuti")(pret Q))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 40 banuti")(pret ?r))))
(defrule r9
(AparatDeCafea (monede "Avem 20 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 25 banuti")(pret ?r))))
(defrule r10
(AparatDeCafea (monede "Avem 20 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 25 banuti")(pret ?r))))
(defrule r11
(AparatDeCafea (monede "Avem 20 banuti")(pret Q))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 45 banuti")(pret ?r))))
(defrule r12
(AparatDeCafea (monede "Avem 25 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 30 banuti")(pret ?r))))
(defrule r13
(AparatDeCafea (monede "Avem 25 banuti")(pret Q))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 50 banuti")(pret ?r))))
(defrule r14
(AparatDeCafea (monede "Avem 30 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 35 banuti")(pret ?r))))
(defrule r15
(AparatDeCafea (monede "Avem 30 banuti")(pret Q))
=>
(printout t "Succes" crlf))
(defrule r16
(AparatDeCafea (monede "Avem 35 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 40 banuti")(pret ?r))))
(defrule r17
(AparatDeCafea (monede "Avem 35 banuti")(pret Q))
=>
(printout t "Succes" crlf))
(defrule r18
(AparatDeCafea (monede "Avem 40 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 45 banuti")(pret ?r))))
(defrule r19
(AparatDeCafea (monede "Avem 40 banuti")(pret Q))
=>
(printout t "Succes" crlf))
(defrule r20
(AparatDeCafea (monede "Avem 45 banuti")(pret N))
=>
(printout t "Introduceti banuti (N/Q)" crlf)
(bind ?r (read))
(assert(AparatDeCafea(monede "Avem 50 banuti")(pret ?r))))
(defrule r21
(AparatDeCafea (monede "Avem 45 banuti")(pret Q))
=>
(printout t "Succes" crlf))
(defrule r22
(AparatDeCafea (monede "Avem 50 banuti")(pret Q))
=>
(printout t "Succes" crlf))
(defrule r23
(AparatDeCafea (monede "Avem 50 banuti")(pret N))
=>
(printout t "Succes" crlf))
(run)

You might also like