Advertisement
Guest User

clips

a guest
Apr 29th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. (defglobal
  2. ?*a* = 1)
  3.  
  4. (deftemplate cars
  5. (slot name (type SYMBOL))
  6. (slot maxspeed(type INTEGER)
  7. (range 0 300))
  8. (slot color (type SYMBOL)
  9. (allowed-symbols green black))
  10. (slot year(default 2000))
  11. (slot time (default-dynamic (bind ?a (+ ?*a* 3)))))
  12.  
  13.  
  14. (deftemplate printers
  15. (slot name(type SYMBOL)
  16. (allowed-symbols HP Canon))
  17. (slot cost(type INTEGER))
  18. (slot year(default 2005))
  19. (slot time(default-dynamic (bind ?a (+ ?*a* 1)))))
  20.  
  21.  
  22.  
  23. (deffacts car
  24. (cars (name bmw)(color green)(maxspeed 300))
  25. (cars (name audi)(color black)(maxspeed 200)(year 2001))
  26. (cars (name lada)(color black)(maxspeed 300)(year 2008))
  27. (cars (name bmw)(color green)(maxspeed 200))(year 2007)))
  28.  
  29. (deffacts printer
  30. (printers (name HP)(cost 10000)(year 2008))
  31. (printers (name Canon)(cost 900))
  32. (printers (name HP)(cost 1200)(year 2015))
  33. (printers (name Canon)(cost 1500)(year 2016)))
  34.  
  35.  
  36. вывести марки авто год ктоторых совпадает с годом выпуска принтера,скорость которого не менее чем в 4 раза меньше стоимости принетера
  37. и цвет которого введется с клв
  38.  
  39.  
  40.  
  41. (defrule dop
  42. (cars(name ?x)(maxspeed ?y)(year ?z)(color ?q))
  43. (printers(name ?w)(cost ?e)(year ?r))
  44. (eq ?z ?r)
  45. (and (test (<(/ ?e ?y) 4)))
  46. =>
  47. (printout t "Enter color")
  48. (bind ?colors (read))
  49. (eq ?q ?colors)
  50. (printout t "Cars: " ?x crlf))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement