开发者

Clips matching expression is not working

he开发者_StackOverflow社区llo in clips i have this template:

(deftemplate cell(slot x)(slot y)(slot alive))

and this fact :

(start 1 1)

then i have this claus in the LHS :

?start<-(start ?x ?y)

and i want to get the variable ?a1

(cell (x (+ ?x 1) )(y ?y)(alive ?a1))

it seems that it's not allowed to add to the variable "(+ ?x 1)" so how can i achieve what i want.


CLIPS> (deftemplate cell (slot x) (slot y) (slot alive)) 
CLIPS>  
(deffacts initial
    (start 1 1)
    (cell (x 2) (y 1) (alive yes)))
CLIPS>     
(defrule example
    (start ?x ?y)
    (cell (x =(+ ?x 1)) (y ?y) (alive ?a1))
    =>
    (printout t "?a1 = " ?a1 crlf))
CLIPS> (reset)
CLIPS> (run)
?a1 = yes
CLIPS> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜