Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defglobal
- ?*a* = 1)
- (deftemplate cars
- (slot name (type SYMBOL))
- (slot maxspeed(type INTEGER)
- (range 0 300))
- (slot color (type SYMBOL)
- (allowed-symbols green black))
- (slot year(default 2000))
- (slot time (default-dynamic (bind ?a (+ ?*a* 3)))))
- (deftemplate printers
- (slot name(type SYMBOL)
- (allowed-symbols HP Canon))
- (slot cost(type INTEGER))
- (slot year(default 2005))
- (slot time(default-dynamic (bind ?a (+ ?*a* 1)))))
- (deffacts car
- (cars (name bmw)(color green)(maxspeed 300))
- (cars (name audi)(color black)(maxspeed 200)(year 2001))
- (cars (name lada)(color black)(maxspeed 300)(year 2008))
- (cars (name bmw)(color green)(maxspeed 200))(year 2007)))
- (deffacts printer
- (printers (name HP)(cost 10000)(year 2008))
- (printers (name Canon)(cost 900))
- (printers (name HP)(cost 1200)(year 2015))
- (printers (name Canon)(cost 1500)(year 2016)))
- вывести марки авто год ктоторых совпадает с годом выпуска принтера,скорость которого не менее чем в 4 раза меньше стоимости принетера
- и цвет которого введется с клв
- (defrule dop
- (cars(name ?x)(maxspeed ?y)(year ?z)(color ?q))
- (printers(name ?w)(cost ?e)(year ?r))
- (eq ?z ?r)
- (and (test (<(/ ?e ?y) 4)))
- =>
- (printout t "Enter color")
- (bind ?colors (read))
- (eq ?q ?colors)
- (printout t "Cars: " ?x crlf))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement