为每个事实执行一次规则

时间:2014-04-08 15:08:14

标签: jess

如何只针对每个事实执行一次规则?

(defrule clean
     ?li<-(VISUAL::removedLine ?line)       
     ?cr<-(point (x ?px) (y ?py &: (< ?py ?line)))
     => 
     (modify ?cr (x ?px) (y (+ 1 ?py))))

当我执行此规则并进行修改时,它将创建一个新点并执行该新点的规则。

例如:

 point (x 1) (y 2)

执行规则

 point (x 1) (y 3)

执行规则

 point (x 1) (y4)

我只想让它执行一次,就像这样:

 point (x 1) (y 2)

执行规则

 point (x 1) (y 3)

1 个答案:

答案 0 :(得分:1)

另一个俄罗斯方块玩家? : - )

无论如何,你必须使用

(defrule clean
   (declare (no-loop TRUE)) 
   ?li<-(VISUAL::removedLine ?line)     
相关问题