开发者

Clips matching expression is not working

开发者 https://www.devze.com 2022-12-29 12:09 出处:网络
he开发者_StackOverflow社区llo in clips i have this template: (deftemplate cell(slot x)(slot y)(slot alive))

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

精彩评论

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

关注公众号