Added ruleset to model thaw after ice-age, and separated out the

herbivore/predation rules into a separate ruleset 'ecology.txt'
This commit is contained in:
Simon Brooke 2014-07-21 11:20:38 +01:00
parent cbdf01c4c2
commit ea1af2103f
7 changed files with 212 additions and 22 deletions

View file

@ -3053,7 +3053,7 @@ objective is to parse rules out of a block of text from a textarea</p>
function, and return the sequence of such functions.</p>
</td><td class="codes"><pre class="brush: clojure">(defn compile-string
[string]
(map #(compile-rule % true) (remove comment? (trim (split string #&quot;\n&quot;)))))</pre></td></tr><tr><td class="docs"><p>Compile each non-comment line of the file indicated by this <code>filename</code> into
(map #(compile-rule % true) (remove comment? (split string #&quot;\n&quot;))))</pre></td></tr><tr><td class="docs"><p>Compile each non-comment line of the file indicated by this <code>filename</code> into
an executable anonymous function, and return the sequence of such functions.</p>
</td><td class="codes"><pre class="brush: clojure">(defn compile-file
[filename]
@ -3404,7 +3404,7 @@ front of the sequence of tokens it returns nil.</p>
(use 'mw-engine.utils)
(let [afn (eval (parse-rule rule-text))]
(cond
(and afn return-tuple?)(list afn rule-text)
(and afn return-tuple?)(list afn (trim rule-text))
true afn))))
([rule-text]
(compile-rule rule-text false)))</pre></td></tr><tr><td class="spacer docs">&nbsp;</td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">Marginalia</a>.&nbsp;&nbsp;Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;