Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;****************
- ;;* DEFFUNCTIONS *
- ;;****************
- (deffunction ask-question (?question $?allowed-values)
- (printout t ?question)
- (bind ?answer (read))
- (if (lexemep ?answer)
- then (bind ?answer (lowcase ?answer)))
- (while (not (member ?answer ?allowed-values)) do
- (printout t ?question)
- (bind ?answer (read))
- (if (lexemep ?answer)
- then (bind ?answer (lowcase ?answer))))
- ?answer)
- (deffunction yes-or-no-p (?question)
- (bind ?response (ask-question ?question tak nie t n))
- (if (or (eq ?response tak) (eq ?response t))
- then yes
- else no))
- ;;;***************
- ;;;* QUERY RULES *
- ;;;***************
- (defrule determine-peaceful-music ""
- (not (peaceful-music ?))
- (not (proposition ?))
- =>
- (assert (peaceful-music (yes-or-no-p "Czy lubisz sluchac spokojnej muzyki (tak/nie)? "))))
- (defrule determine-fingerstyle-music ""
- (peaceful-music yes)
- (not (proposition ?))
- =>
- (assert (fingerstyle-music (yes-or-no-p "Podoba Ci sie styl grania na gitarze o nazwie Fingerstyle (tak/nie)? "))))
- (defrule determine-rock-music ""
- (peaceful-music no)
- (not (proposition ?))
- =>
- (assert (rock-music (yes-or-no-p "Czy lubisz sluchac rocka (tak/nie)? "))))
- (defrule determine-fingerstyle ""
- (fingerstyle-music yes)
- (not (proposition ?))
- =>
- (assert (fingerstyle-favorite (ask-question "Wolisz Romance de Amour czy Noche Acosador (romance/noche)? "
- romance noche))))
- (defrule determine-standard-playing ""
- (fingerstyle-music no)
- (not (proposition ?))
- =>
- (assert (standard-playing (ask-question "Wolisz grac na gitarze piosenki przy ognisku czy zajac sie gra bardziej na powaznie (ognisko/powaga)? "
- ognisko powaga))))
- (defrule determine-rock-type ""
- (rock-music yes)
- (not (proposition ?))
- =>
- (assert (rock-type (ask-question "Jakiego rocka lubisz sluchac? (lekki/sredni/ciezki)? "
- lekki sredni ciezki))))
- (defrule determine-metal-music ""
- (rock-music no)
- (not (proposition ?))
- =>
- (assert (metal-music (yes-or-no-p "Czy lubisz sluchac metalu (tak/nie)? "))))
- (defrule determine-metal-type ""
- (metal-music yes)
- (not (proposition ?))
- =>
- (assert (metal-type (ask-question "Ktorego z tych zespolu metalowego lubisz sluchac najbardziej? (metallica/slipknot/marilynmanson)? "
- metallica slipknot marilynmanson))))
- ;;;****************
- ;;;* PROPOSITIONS RULES *
- ;;;****************
- (defrule fingerstyle-romance-conclusions ""
- (fingerstyle-favorite romance)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara klasyczna!")))
- (defrule fingerstyle-noche-conclusions ""
- (fingerstyle-favorite noche)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara akustyczna")))
- (defrule standard-playing-ognisko-conclusions ""
- (standard-playing ognisko)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara klasyczna")))
- (defrule standard-playing-powaga-conclusions ""
- (standard-playing powaga)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara akustyczna")))
- (defrule rock-type-lekki-conclusions ""
- (rock-type lekki)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara elektryczna, najlepiej z trzema przetwornikami typu Single!")))
- (defrule rock-type-sredni-conclusions ""
- (rock-type lekki)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara elektryczna, najlepiej z dwoma przetwornikami typu Single (neck i middle) oraz jednym przetwornikiem typu Humbucker (bridge)!")))
- (defrule rock-type-ciezki-conclusions ""
- (rock-type ciezki)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara elektryczna, najlepiej z dwoma przetwornikami typu Humbucker (bridge i neck)!")))
- (defrule metal-type-metallica-conclusions ""
- (metal-type metallica)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara elektryczna, najlepiej ESP LTD z dwoma przetwornikami typu Humbucker, modele EMG81 (bridge) oraz EMG60 (neck)!")))
- (defrule metal-type-slipknot-conclusions ""
- (metal-type slipknot)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara elektryczna, najlepiej Fender Telecaster z przetwornikami typu Humbucker firmy EMG lub B.C. Rich z Seymour Duncanami!")))
- (defrule metal-type-marilynmanson-conclusions ""
- (metal-type marilynmanson)
- (not (proposition ?))
- =>
- (assert (proposition "Gitara elektryczna, najlepiej Gibson Thunderbird na fabrycznych przetwornikach typu Humbucker lub Fender Telecaster sygnowany przez John'a 5!")))
- (defrule no-propositions ""
- (declare (salience -10))
- (not (proposition ?))
- =>
- (assert (proposition "Nie kupuj gitary :-)")))
- ;;;********************************
- ;;;* STARTUP AND CONCLUSION RULES *
- ;;;********************************
- (defrule system-banner ""
- (declare (salience 10))
- =>
- (printout t crlf crlf)
- (printout t "System doradzania do wyboru rodzaju gitary")
- (printout t crlf crlf))
- (defrule print-proposition ""
- (declare (salience 10))
- (proposition ?item)
- =>
- (printout t crlf crlf)
- (printout t "Proponowana rodzaj gitary:")
- (printout t crlf crlf)
- (format t " %s%n%n%n" ?item))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement