(deftemplate question
(slot stringquestion)
(slot answer)
)
(deftemplate faculty
(multislot name))
(assert (question (stringquestion nil)(answer nil)))
(assert (faculty (name nil)))
(defrule q
(declare (salience 100))
(question (stringquestion nil)(answer nil))
=>
(printout t "Do you want some guiYnce in choosing you faculty? [Y/N]" crlf)
(bind ?r (read))
(assert (question (stringquestion "Do you want some guiYnce in choosing you faculty?")(answer ?r)))
)
(defrule r1
(declare (salience 99))
(question (stringquestion "Do you want some guiYnce in choosing you faculty?")(answer N))
=>
(printout t "Thank you!" crlf)
)
(defrule q0
(declare (salience 78))
(question (stringquestion "Do you want some guiYnce in choosing you faculty?")(answer Y))
=>
(printout t "Ok. Your mathematic grade is?" crlf)
(bind ?r (read))
(assert (question (stringquestion "Your mathematic grade is?")(answer ?r)))
)
(defrule q1
(declare (salience 99))
(question (stringquestion "Your mathematic grade is?")(answer ?x & : (>= ?x 8)))
=>
(printout t "Your IT grade is?" crlf)
(bind ?r (read))
(assert (question (stringquestion "Your IT grade is?")(answer ?r)))
)
(defrule q2
(declare (salience 78))
(question (stringquestion "Your mathematic grade is?")(answer ?x & : (< ?x 8)))
=>
(printout t "Your Literatur grade is?" crlf)
(bind ?r (read))
(assert (question (stringquestion "Your Literatur grade is?")(answer ?r)))
)
(defrule q3
(declare (salience 99))
(question (stringquestion "Your IT grade is?")(answer ?x & : (>= ?x 8)))
=>
(printout t "Your physics grade is?" crlf)
(bind ?r (read))
(assert (question (stringquestion "Your physics grade is?")(answer ?r)))
)
(defrule q4
(declare (salience 78))
(question (stringquestion "Your IT grade is?")(answer ?x & : (< ?x 8)))
=>
(printout t "You should choose FEAA" crlf)
)
(defrule r2
(declare (salience 99))
(question (stringquestion "Your physics grade is?")(answer ?x & : (>= ?x 8)))
=>
(printout t "You shoul choose UPT" crlf)
)
(defrule r3
(declare (salience 78))
(question (stringquestion "Your physics grade is?")(answer ?x & : (< ?x 8)))
=>
(printout t "You should choose the Faculty of Mathematics and Computer Science" crlf)
)
(defrule q5
(declare (salience 99))
(question (stringquestion "Your Literatur grade is?")(answer ?x & : (>= ?x 8)))
=>
(printout t "Your Foreign Language grade is?" crlf)
(bind ?r (read))
(assert (question (stringquestion "Your Foreign language grade is?")(answer ?r)))
)
(defrule q6
(declare (salience 78))
(question (stringquestion "Your Biology grade is?")(answer ?x & : (< ?x 8)))
=>
(printout t "Your physics grade is?" crlf)
(bind ?r (read))
(assert (question (stringquestion "Your Biology grade is?")(answer ?r)))
)
(defrule r6
(declare (salience 99))
(question (stringquestion "Your Foreign language grade is?")(answer ?x & : (>= ?x 8)))
=>
(printout t "You should choose the Faculty of Literature ." crlf)
)
(defrule r7
(declare (salience 78))
(question (stringquestion "Your Foreign language grade is?")(answer ?x & : (< ?x 8)))
=>
(printout t "You should choose the Faculty of Political Science" crlf)
)
(defrule r8
(declare (salience 99))
(question (stringquestion "Your Biology grade is?")(answer ?x & : (>= ?x 8)))
=>
(printout t "You should choose UMF" crlf)
)
(defrule r9
(declare (salience 78))
(question (stringquestion "Your Biology grade is?")(answer ?x & : (< ?x 8)))
=>
(printout t "You should choose the Faculty of Geografy." crlf)
)
(facts)
(agenY)
(run)