2010-05-09 41 views
0

你好,我有這樣的模板:剪輯匹配的表情不是剪輯工作

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

和這樣一個事實:

(start 1 1) 

然後我有這個聖誕老人的LHS:

?start<-(start ?x ?y) 

,我想獲得變量?a1

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

它似乎不允許添加到變量"(+ ?x 1)"那麼如何 我可以達到我想要的。

+2

通過使用「代碼示例」按鈕將代碼段標記爲代碼,可以使您的文章更清晰易讀。 – Cerin 2010-07-06 21:30:45

回答

1
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>