步子很小,稍安勿躁。
(deftemplate 某种
(slot 编号)
(slot 出生时间))
(deftemplate 世界
(slot 时间)
)
(defrule 开始
=>
(println "开天辟地")
(assert (世界 (时间 0)))
(assert (某种 (编号 0) (出生时间 0))))
; 当无优先级声明时,规则编写顺序决定了执行的优先级!
(defrule 时间流逝
?环境 <- (世界 (时间 ?时间))
=>
(modify ?环境 (时间 (+ ?时间 1)))
)
(defrule 繁衍
(declare (salience 10))
(世界 (时间 ?时间))
(某种 (编号 ?编号) (出生时间 ?出生时间))
(test (= 10000000 (- ?时间 ?出生时间)))
=>
(assert (某种 (编号 (+ 1 ?编号)) (出生时间 ?时间)))
)
待续。
![]() |
1
xuanwu OP [0.2 步:随机觅食]( https://zhuanlan.zhihu.com/p/1899286160301355808)
|
![]() |
2
xuanwu OP |
![]() |
3
xuanwu OP |
![]() |
4
xuanwu OP 0.5:求最近;取属性、查事实等函数
https://zhuanlan.zhihu.com/p/1904371634070085633 |