V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
谷否 | 三分谷地,为你喜欢
AI 大模型 + 柔性供应链,不仅可以为你测试香水味道,还能一件定制实体香水,快速发货。
Promoted by wuqiwen
xuanwu
V2EX  ›  分享创造

[不定更] 用 CLIPS 模拟生态

  •  
  •   xuanwu · 86 天前 · 1089 次点击
    这是一个创建于 86 天前的主题,其中的信息可能已经有所发展或是发生改变。

    初入门 后,用 CLIPS 改写 生态模拟

    步子很小,稍安勿躁。

    (deftemplate 某种
      (slot 编号)
      (slot 出生时间))
    
    (deftemplate 世界
      (slot 时间)
    )
    
    (defrule 开始
      =>
      (println "开天辟地")
      (assert (世界 (时间 0)))
      (assert (某种 (编号 0) (出生时间 0))))
    
    ; 当无优先级声明时,规则编写顺序决定了执行的优先级!
    
    (defrule 时间流逝
      ?环境 <- (世界 (时间 ?时间))
      =>
      (modify ?环境 (时间 (+ ?时间 1)))
    )
    
    (defrule 繁衍
      (declare (salience 10))
      (世界 (时间 ?时间))
      (某种 (编号 ?编号) (出生时间 ?出生时间))
      (test (= 10000000 (- ?时间 ?出生时间)))
      =>
      (assert (某种 (编号 (+ 1 ?编号)) (出生时间 ?时间)))
    )
    

    待续。

    xuanwu
        1
    xuanwu  
    OP
       77 天前
    xuanwu
        2
    xuanwu  
    OP
       74 天前
    xuanwu
        3
    xuanwu  
    OP
       72 天前
    xuanwu
        4
    xuanwu  
    OP
       64 天前
    0.5:求最近;取属性、查事实等函数
    https://zhuanlan.zhihu.com/p/1904371634070085633
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   842 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 20:38 · PVG 04:38 · LAX 13:38 · JFK 16:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.