Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (deffunction input (?question)
- (printout t ?question)
- (bind ?answer (read))
- ?answer
- )
- (defrule get-companion
- =>
- (printout t crlf)
- (printout t "-----------------------------------------------------------------------------" crlf)
- (printout t "-------------------- WELCOME TO THE MOVIE RECOMMENDATION --------------------" crlf)
- (printout t "-----------------------------------------------------------------------------" crlf)
- (printout t crlf)
- (assert (companion
- (input "Who are you going to watch with? (family/partner/alone): ")
- ))
- )
- (defrule watch_with_family (companion family)
- =>
- (printout t crlf)
- (printout t "Let me select a movie suitable to watch with your family..." crlf crlf)
- (assert (genre
- (input "Enter your preferred genre (animation/fantasy/horror): ")
- ))
- )
- (defrule watch_with_partner (companion partner)
- =>
- (printout t crlf)
- (printout t "Let me select a movie suitable to watch with your partner..." crlf crlf)
- (assert (genre
- (input "Enter your preferred genre (crime/comedy/drama): ")
- ))
- )
- (defrule watch_alone (companion alone)
- =>
- (printout t crlf)
- (printout t "Let me select a movie that you can enjoy alone..." crlf crlf)
- (assert (genre
- (input "Enter your preferred genre (comedy/action/thriller): ")
- ))
- )
- (defrule watch_animation_movie_with_family
- (companion family)
- (genre animation)
- =>
- (assert (suggested-movie "Finding Nemo"))
- )
- (defrule watch_fantasy_movie_with_family
- (companion family)
- (genre fantasy)
- =>
- (assert (suggested-movie "Harry Potter"))
- )
- (defrule watch_horror_movie_with_family
- (companion family)
- (genre horror)
- =>
- (assert (suggested-movie "The Conjuring"))
- )
- (defrule watch_crime_movie_with_partner
- (companion partner)
- (genre crime)
- =>
- (assert (suggested-movie "Mr. & Mrs. Smith"))
- )
- (defrule watch_comedy_movie_with_partner
- (companion partner)
- (genre comedy)
- =>
- (assert (suggested-movie "The Girl Next Door"))
- )
- (defrule watch_drama_movie_with_partner
- (companion partner)
- (genre drama)
- =>
- (assert (suggested-movie "Casablanca"))
- )
- (defrule watch_comedy_movie_alone
- (companion alone)
- (genre comedy)
- =>
- (assert (suggested-movie "Free Guy"))
- )
- (defrule watch_action_movie_alone
- (companion alone)
- (genre action)
- =>
- (assert (suggested-movie "The Batman"))
- )
- (defrule watch_thriller_movie_alone
- (companion alone)
- (genre thriller)
- =>
- (assert (suggested-movie "Don't Breathe 2"))
- )
- (defrule suggest-movie (declare (salience -1))
- (suggested-movie ?movie)
- =>
- (printout t "-----------------------------------------------------------------------------" crlf)
- (printout t "The recommended movie which best suits your needs is: " ?movie crlf)
- (printout t "-----------------------------------------------------------------------------" crlf)
- )
Add Comment
Please, Sign In to add comment