(clear)
(deftemplate anak (slot x) (slot y))
(assert (anak (x Marthin) (y Alden)))
(assert (anak (x Endang) (y Asniar)))
(assert (anak (x Marthin) (y Netty)))
(assert (anak (x Endang) (y Doni)))
(assert (anak (x Julius) (y Alden)))
(assert (anak (x Alden) (y Jese)))
(assert (anak (x Marlinang) (y Jese)))
(assert (anak (x Asniar) (y Jese)))
(assert (anak (x Julius) (y Alden)))
(assert (anak (x Dewi) (y Marlinang)))
(defrule cucu
?x <- (anak (x ?x1) (y ?y1))
?y <- (anak (x ?x2) (y ?y2))
(test (eq ?x1 ?y2))
(test (neq ?x2 ?y1))
=>
(printout t ?x2 " cucu " ?y1 crlf))
(defrule saudara
?x <- (anak (x ?x1) (y ?y1))
?y <- (anak (x ?x2) (y ?y2))
(test (eq ?y1 ?y2))
(test (neq ?x1 ?x2))
=>
(printout t ?x1 " saudara " ?x2 crlf))
(defrule ortu
?x <- (anak (x ?x1) (y ?y1)) ?y <- (anak (x ?x2) (y ?y2)) (test (eq ?x1 ?x2)) (test (neq ?y1 ?y2)) =>
(printout t ?y2 " ortu " ?x1 crlf))
(defrule pasangan
?x <- (anak (x ?x1) (y ?y1))
?y <- (anak (x ?x2) (y ?y2))
(test (eq ?x1 ?x2))
(test (neq ?y1 ?y2))
=>
(printout t ?y1 " pasangan " ?y2 crlf))
(defrule keponakan
?x <- (anak (x ?x1) (y ?y1))
?y <- (anak (x ?x2) (y ?y2))
?z <- (anak (x ?x3) (y ?y3))
(test (eq ?y2 ?y1))
(test (neq ?x1 ?x2))
(test (eq ?x2 ?y3))
=>
(printout t ?x3 " keponakan " ?x1 crlf))
(defrule opung
(anak (x ?x1) (y ?y1))
(anak (x ?x2) (y ?y2))
(test (eq ?y1 ?x2))
=>
(printout t ?y2 " opung " ?x1 crlf)
)
(defrule sepupu
?a <- (anak (x ?x1) (y ?y1))
?b <- (anak (x ?x2) (y ?y2))
?c <- (anak (x ?x3) (y ?y3))
?d <- (anak (x ?x4) (y ?y4))
(test (eq ?y1 ?x2))
(test (eq ?y2 ?y3))
(test (neq ?x2 ?x3))
(test (eq ?x3 ?y4))
=>
(printout t ?x1 " sepupu " ?x4 crlf))
CLIPS (Program Silsilah Keluarga)
By Martin Blog
Category:
2
komentar
Langganan:
Posting Komentar (Atom)
2 komentar:
Semoga ini dapat membantu teman-teman sekalian ya..
Yang terpenting tetap Semangat Belajar dan menggali Ilmu Pengetahuan...
Regards
Martin (admin)
halo gan, dasar program clips gmana ya gan??? contohnya dan strukturnya
Posting Komentar