Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. (defrule dodatek_do_kawy
  2. (wybrana_kawa ?wybrana_kawa)
  3. (potwierdz_wybrana_kawe ?potwierdz_wybrana_kawe)
  4. (test (= 0 (str-compare ?potwierdz_wybrana_kawe "tak")))
  5. =>
  6. (bind ?ciastko 0)
  7. (bind ?cukier_trzcinowy 0)
  8. (bind ?cukier_brazowy 0)
  9. (bind ?cukier_bialy 0)
  10. (bind ?cynamon 0)
  11. (bind ?kakao 0)
  12. (bind ?wybor_dodatku 1)
  13. (while (= 1 ?wybor_dodatku)
  14. (printout t "Czy chcesz jeszcze jakis dodatek do kawy?" crlf)
  15. (if (= 0 ?ciastko)
  16. then
  17. (printout t "1. Ciastko" crlf)
  18. else
  19. (printout t "1. Ciastko <-- JUZ WYBRANO" crlf)
  20. )
  21. (if (= 0 ?cukier_trzcinowy)
  22. then
  23. (printout t "2. Cukier trzcinowy" crlf)
  24. else
  25. (printout t "2. Cukier trzcinowy <-- JUZ WYBRANO" crlf)
  26. )
  27. (if (= 0 ?cukier_brazowy)
  28. then
  29. (printout t "3. Cukier brazowy" crlf)
  30. else
  31. (printout t "3. Cukier brazowy <-- JUZ WYBRANO" crlf)
  32. )
  33. (if (= 0 ?cukier_bialy)
  34. then
  35. (printout t "4. Cukier bialy" crlf)
  36. else
  37. (printout t "4. Cukier bialy <-- JUZ WYBRANO" crlf)
  38. )
  39. (if (= 0 ?cynamon)
  40. then
  41. (printout t "5. Cynamon" crlf)
  42. else
  43. (printout t "5. Cynamon <-- JUZ WYBRANO" crlf)
  44. )
  45. (if (= 0 ?kakao)
  46. then
  47. (printout t "6. Kakao" crlf)
  48. else
  49. (printout t "6. Kakao <-- JUZ WYBRANO" crlf)
  50. )
  51. (printout t "7. Nie chce wiecej dodatkow" crlf)
  52. (printout t "Wybierz, wpisujac liczbe od 1 do 7: ")
  53. (bind ?wybrany_dodatek (readline))
  54. (bind ?wybrany_dodatek (lowcase ?wybrany_dodatek))
  55. (while(and (<> 0 (str-compare ?wybrany_dodatek "1")) (<> 0 (str-compare ?wybrany_dodatek "2")) (<> 0 (str-compare ?wybrany_dodatek "3")) (<> 0 (str-compare ?wybrany_dodatek "4")) (<> 0 (str-compare ?wybrany_dodatek "5")) (<> 0 (str-compare ?wybrany_dodatek "6")) (<> 0 (str-compare ?wybrany_dodatek "7")))
  56. (printout t "Wybierz, wpisujac liczbe od 1 do 7: ")
  57. (bind ?wybrany_dodatek (readline))
  58. )
  59. (printout t crlf)
  60. (switch ?wybrany_dodatek
  61. (case "1" then
  62. (if (= 1 ?ciastko)
  63. then
  64. (printout t "Ten dodatek zostal juz wybrany..." crlf)
  65. else
  66. (bind ?ciastko 1)
  67. )
  68. )
  69. (case "2" then
  70. (if (= 1 ?cukier_trzcinowy)
  71. then
  72. (printout t "Ten dodatek zostal juz wybrany..." crlf)
  73. else
  74. (bind ?cukier_trzcinowy 1)
  75. )
  76. )
  77. (case "3" then
  78. (if (= 1 ?cukier_brazowy)
  79. then
  80. (printout t "Ten dodatek zostal juz wybrany..." crlf)
  81. else
  82. (bind ?cukier_brazowy 1)
  83. )
  84. )
  85. (case "4" then
  86. (if (= 1 ?cukier_bialy)
  87. then
  88. (printout t "Ten dodatek zostal juz wybrany..." crlf)
  89. else
  90. (bind ?cukier_bialy 1)
  91. )
  92. )
  93. (case "5" then
  94. (if (= 1 ?cynamon)
  95. then
  96. (printout t "Ten dodatek zostal juz wybrany..." crlf)
  97. else
  98. (bind ?cynamon 1)
  99. )
  100. )
  101. (case "6" then
  102. (if (= 1 ?kakao)
  103. then
  104. (printout t "Ten dodatek zostal juz wybrany..." crlf)
  105. else
  106. (bind ?kakao 1)
  107. )
  108. )
  109. (case "7" then
  110. (bind ?wybor_dodatku 0)
  111. )
  112. (default "Blad w wybrany_dodatek")
  113. )
  114. )
  115. (assert (ciastko ?ciastko)(cukier_trzcinowy ?cukier_trzcinowy)(cukier_brazowy ?cukier_brazowy)(cukier_bialy ?cukier_bialy)(cynamon ?cynamon)(kakao ?kakao)(wybor_dodatku ?wybor_dodatku))
  116. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement