Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defrule dodatek_do_kawy
- (wybrana_kawa ?wybrana_kawa)
- (potwierdz_wybrana_kawe ?potwierdz_wybrana_kawe)
- (test (= 0 (str-compare ?potwierdz_wybrana_kawe "tak")))
- =>
- (bind ?ciastko 0)
- (bind ?cukier_trzcinowy 0)
- (bind ?cukier_brazowy 0)
- (bind ?cukier_bialy 0)
- (bind ?cynamon 0)
- (bind ?kakao 0)
- (bind ?wybor_dodatku 1)
- (while (= 1 ?wybor_dodatku)
- (printout t "Czy chcesz jeszcze jakis dodatek do kawy?" crlf)
- (if (= 0 ?ciastko)
- then
- (printout t "1. Ciastko" crlf)
- else
- (printout t "1. Ciastko <-- JUZ WYBRANO" crlf)
- )
- (if (= 0 ?cukier_trzcinowy)
- then
- (printout t "2. Cukier trzcinowy" crlf)
- else
- (printout t "2. Cukier trzcinowy <-- JUZ WYBRANO" crlf)
- )
- (if (= 0 ?cukier_brazowy)
- then
- (printout t "3. Cukier brazowy" crlf)
- else
- (printout t "3. Cukier brazowy <-- JUZ WYBRANO" crlf)
- )
- (if (= 0 ?cukier_bialy)
- then
- (printout t "4. Cukier bialy" crlf)
- else
- (printout t "4. Cukier bialy <-- JUZ WYBRANO" crlf)
- )
- (if (= 0 ?cynamon)
- then
- (printout t "5. Cynamon" crlf)
- else
- (printout t "5. Cynamon <-- JUZ WYBRANO" crlf)
- )
- (if (= 0 ?kakao)
- then
- (printout t "6. Kakao" crlf)
- else
- (printout t "6. Kakao <-- JUZ WYBRANO" crlf)
- )
- (printout t "7. Nie chce wiecej dodatkow" crlf)
- (printout t "Wybierz, wpisujac liczbe od 1 do 7: ")
- (bind ?wybrany_dodatek (readline))
- (bind ?wybrany_dodatek (lowcase ?wybrany_dodatek))
- (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")))
- (printout t "Wybierz, wpisujac liczbe od 1 do 7: ")
- (bind ?wybrany_dodatek (readline))
- )
- (printout t crlf)
- (switch ?wybrany_dodatek
- (case "1" then
- (if (= 1 ?ciastko)
- then
- (printout t "Ten dodatek zostal juz wybrany..." crlf)
- else
- (bind ?ciastko 1)
- )
- )
- (case "2" then
- (if (= 1 ?cukier_trzcinowy)
- then
- (printout t "Ten dodatek zostal juz wybrany..." crlf)
- else
- (bind ?cukier_trzcinowy 1)
- )
- )
- (case "3" then
- (if (= 1 ?cukier_brazowy)
- then
- (printout t "Ten dodatek zostal juz wybrany..." crlf)
- else
- (bind ?cukier_brazowy 1)
- )
- )
- (case "4" then
- (if (= 1 ?cukier_bialy)
- then
- (printout t "Ten dodatek zostal juz wybrany..." crlf)
- else
- (bind ?cukier_bialy 1)
- )
- )
- (case "5" then
- (if (= 1 ?cynamon)
- then
- (printout t "Ten dodatek zostal juz wybrany..." crlf)
- else
- (bind ?cynamon 1)
- )
- )
- (case "6" then
- (if (= 1 ?kakao)
- then
- (printout t "Ten dodatek zostal juz wybrany..." crlf)
- else
- (bind ?kakao 1)
- )
- )
- (case "7" then
- (bind ?wybor_dodatku 0)
- )
- (default "Blad w wybrany_dodatek")
- )
- )
- (assert (ciastko ?ciastko)(cukier_trzcinowy ?cukier_trzcinowy)(cukier_brazowy ?cukier_brazowy)(cukier_bialy ?cukier_bialy)(cynamon ?cynamon)(kakao ?kakao)(wybor_dodatku ?wybor_dodatku))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement