diff --git a/resources/rules.txt b/resources/rules.txt index a6c70dd..4fcb105 100644 --- a/resources/rules.txt +++ b/resources/rules.txt @@ -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 diff --git a/src/mw_parser/core.clj b/src/mw_parser/core.clj index c696499..ab402d1 100644 --- a/src/mw_parser/core.clj +++ b/src/mw_parser/core.clj @@ -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