Still some bugs in rules generated from rule-language source. However,

a great deal does work.
This commit is contained in:
Simon Brooke 2014-07-14 23:22:33 +01:00
parent e1ed824aff
commit 7375b668c0
2 changed files with 7 additions and 5 deletions

View file

@ -19,7 +19,8 @@ if state is forest and fertility is more than 5 then state should be climax
if state is climax then 1 chance in 500 state should be fire
;; Climax forest neighbouring fires is likely to catch fire
;; TODO: this rule, and specifically the 'some neighbours' clause, seems to give
;; rise to the 'Keyword cannot be cast to Number' bug.
if state is climax and some neighbours are fire then 1 chance in 3 state should be fire
;; After fire we get waste
@ -34,8 +35,9 @@ if state is waste and some neighbours are forest then state should be heath
if state is waste and some neighbours are climax then state should be heath
if state is waste then state should be grassland
;; Forest increases soil fertility
if state is in forest or climax then fertility should be fertility - 1
;; Forest increases soil fertility. TODO: this rule compiles to what looks like
;; the right code but it never fires.
if state is in forest or climax then fertility should be fertility + 1
## Herbivore rules

View file

@ -190,9 +190,9 @@
(cond (and (= comp1 "equal") (= comp2 "to"))
(gen-neighbours-condition comparator quantity property value remainder '=)
(and (= comp1 "more") (= comp2 "than"))
(gen-neighbours-condition '> quantity property value remainder '>)
(gen-neighbours-condition comparator quantity property value remainder '>)
(and (= comp1 "less") (= comp2 "than"))
(gen-neighbours-condition '< quantity property value remainder '<)
(gen-neighbours-condition comparator quantity property value remainder '<)
))))))
(defn parse-some-neighbours-condition