zegarekk clp


(deffunction logo ( ?q1 ?q2 ?q3 ?q4)
(printout t --------------------- crlf
" _____ " ?q1 crlf
" |-------( )--------| " ?q2 crlf
" -| C( |_ ) oooo | " ?q3 crlf
" |-------(_____)--------| " ?q4 crlf)
)

(deffunction linia (?i ?j)
(if (eq ?i 1) then (printout t "*********************************" crlf))
)

(deffunction liniaEr (?i ?j)
(if (eq ?i 1) then (printout t "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" crlf))
)

(deffunction liniaSt (?i ?j)
(if (eq ?i 1) then (printout t "---------------------------------" crlf))
)



(defrule start
=>
(linia 1 0)
(logo " Witaj w naszym sklepie inernetowym!"
" Oto system"
" pomoze ci w wyborze odpowiedniego zegarka"
" to zaczynamy ? (t/n)")
(linia 1 0)
(assert ( start ( read ) ) )
(printout t crlf)
)

(defrule koniec
(start n)
=>
(printout t crlf)
(printout t "Zapraszamy ponownie!" crlf)
)


(defrule pyt1
(start t)
=>
(liniaSt 1 0)
(printout t "Chcesz kupic zegarek damski czy meski ? (u/n)" crlf)
(linia 1 1)
(assert (pyt1 (read) ) )
)

(defrule cena
(start t)
(pyt1 n)
(or (marka c) (marka a) (marka t))
=>
(liniaSt 1 0)
(printout t "W jakiej cenie chcesz kupic zegarek ? (podaj kwote np. 200 zlotych)" crlf)
(linia 1 1)
(assert (kwota (read) ) )
(printout t crlf)
)

(defrule ekran
(start t)
(pyt1 u)
=>
(liniaSt 1 0)
(printout t "O jakiej wielkosci tarczy ?" crlf)
(linia 1 1)
(printout t "1 - ponizej mala" crlf)
(printout t "2 - pomiedzy srednia" crlf)
(printout t "3 - powyzej duza" crlf)
(assert (ekran (read) ) )
(printout t crlf)
)

(defrule wynik1
(start t)
(pyt1 u)
(ekran 1)
=>
(linia 1 0)
(printout t "Proponujemy Casio LTP 1347D " crlf)
(linia 1 1)
)

(defrule wynik2
(start t)
(pyt1 u)
(ekran 2)
=>
(linia 1 0)
(printout t "Proponujemy Casio LTP 1264G" crlf)
(linia 1 1)
)

(defrule wynik3
(start t)
(pyt1 u)
(ekran 3)
=>
(linia 1 0)
(printout t "Proponujemy Casio Classic STRAP" crlf)
(linia 1 1)
)

***********************************************************

(defrule blad
(start t)
(pyt1 u)
(not (ekran 1) )
(not (ekrn 2) )
(not (ekran 3) )
=>
(liniaEr 1 0)
(printout t "Brak wynikow dla tych wyznaczniow. Sprobuj ponownie" crlf)
(liniaEr 1 1)
)


(defrule marka
(start t)
(pyt1 n)
=>
(printout t "Zegarek jakiej marki Cie interesuje?" crlf)
(liniaSt 1 0)
(printout t crlf)
(printout t "c - Casio" crlf)
(printout t "a - Adriatica" crlf)
(printout t "t - Timex" crlf)
(linia 1 1)
(assert (marka (read)))
(printout t crlf)
)

***********************************************************

(defrule blad1
(start t)
(pyt1 n)
(not (marka c))
(not (marka a))
(not (marka t))
=>
(liniaEr 1 0)
(printout t "Nie posiadamy zegarka tej firmy. Sprobuj jeszcze raz" crlf)
(liniaEr 1 1)
)

___________________________________________________________

(defrule zeg1
(start t)
(pyt1 n)
(marka c)
(kwota ?ceny)
=>
(liniaSt 1 0)
(if (<= ?ceny 100) then (printout t "Nie posiadamy zegarka Casio w cenie ponizej 100 zlotych" crlf) )
(if (> ?ceny 200) then (printout t "Proponujemy zegarek Casio LTP 1347D w cenie 220 zlotych" crlf) )
(if (>= ?ceny 300) then (printout t "Proponujemy zegarek Casio LTP 1264G w cenie 319 zlotych" crlf) )
(if (>= ?ceny 500) then (printout t "Proponujemy zegarek Classic STRAP w cenie 500 zlotych" crlf) )
(if (>= ?ceny 600) then (printout t "Aktualnie nie posiadamy zegarka Casio w tej cenie lub wyzszej" crlf) )
(printout t crlf)
(liniaSt 1 0)
(printout t "Czy chcialbys wykupic dodatkowa gwarancje ? (t/n)" crlf)
(linia 1 1)
(assert (pyt2 (read) ) )
(printout t crlf)
)


(defrule zeg2
(start t)
(pyt1 n)
(marka a)
(kwota ?ceny)
=>
(liniaSt 1 0)
(if (<= ?ceny 200) then (printout t "Nie posadamy zegarka tej marki w cenie ponizej 200 zlotych" crlf) )
(if (> ?ceny 300) then (printout t "Proponujemy zegarek Adriatica Classic w cenie 360 zlotych." crlf) )
(if (>= ?ceny 400) then (printout t "Proponujemy zegarek Adriatica Fashion w cenie 499 zlotych " crlf) )
(if (>= ?ceny 600) then (printout t "Proponujemy zegarek Adriatica Ceramic w cenie 600 zlotych" crlf) )
(if (>= ?ceny 900) then (printout t "Nie posiadamy zegarka Adriatica w tej cenie lub wyzszej" crlf) )
(printout t crlf)
(liniaSt 1 0)
(printout t "Czy chcialbys wykupic dodatkowa gwarancje ? (t/n)" crlf)
(linia 1 1)
(assert (pyt2 (read) ) )
(printout t crlf)
)


(defrule tel3
(start t)
(pyt1 n)
(marka t)
(kwota ?ceny)
=>
(liniaSt 1 0)
(if (<= ?ceny 200) then (printout t "Nie posiadamy zegarka Timex poniżej tej ceny" crlf) )
(if (> ?ceny 300) then (printout t "Proponujemy zegarek Timex Everyday Dress w cenie 328 zlotych" crlf) )
(if (>= ?ceny 400) then (printout t "Proponujemy zegarek Timex Ladies Originals w cenie 450 zlotych " crlf) )
(if (>= ?ceny 550) then (printout t "Proponujemy zegarek Timex Chronograph w cenie 550 zlotych" crlf) )
(if (>= ?ceny 900) then (printout t "Nie posiadamy zegarka Timex w tej cenie lub wyzszej" crlf) )
(printout t crlf)
(liniaSt 1 0)
(printout t "Czy chcialbys wykupic dodatkowa gwarancje ? (t/n)" crlf)
(linia 1 1)
(assert (pyt2 (read) ) )
(printout t crlf)
)

(defrule pyt2
(start t)
(pyt1 n)
(marka t)
(kwota ?ceny)
=>
(printout t crlf)
(liniaSt 1 0)
(printout t "Czy chcialbys wykupic dodatkowa gwarancje ? (t/n)" crlf)
(linia 1 1)
(assert (pyt2 (read) ) )
(printout t crlf)
)


(defrule pyt2n
(start t)
(pyt1 n)
(or (marka c) (marka a) (marka t))
(kwota ?ceny)
(pyt2 n)
=>
(linia 1 0)
(printout t "Dziekujemy, do widzenia!" crlf)
(linia 1 1)
)

(defrule pyt2t
(start t)
(pyt1 n)
(or (marka n) (marka l) (marka s))
(kwota ?ceny)
(pyt2 t)
=>
(liniaSt 1 0)
(bind ?gwarancja (/ ?ceny 6))
(printout t "Roczna gwarancja wynosi około " (round ?gwarancja) " zlotych" crlf)
(printout t "Do widzenia !" crlf)
(linia 1 1)
)

(defrule pyt2blad
(start t)
(pyt1 n)
(or (marka c) (marka a) (marka t))
(kwota ?ceny)
(not (pyt2 t))
(not (pyt2 n))
=>
(liniaEr 1 0)
(printout t "Bledna wartosc, sprobuj jeszcze raz" crlf)
(liniaEr 1 1)
)

Wyszukiwarka

Podobne podstrony:
js zegarek na www
ZEGAREK
Zegarek kwarcowy
Zajebisty zegarek
ZEGAREK (4)
instrukcja zegarek casio g shock g300
diagnoza zegarem modułowym
Zegarek
Zegarek w dolnym rogu
zegarek;davida;coultharda,artykul,9975
zegarek z grafikami
zegarek (2)

więcej podobnych podstron