Kibitised.
This commit is contained in:
parent
34d3745ecb
commit
03733f8ddf
|
@ -3115,7 +3115,7 @@ front of the sequence of tokens it returns nil.</p>
|
|||
</td><td class="codes"></td></tr><tr><td class="docs"><p>Parse a number.</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn parse-numeric-value
|
||||
[[value & remainder]]
|
||||
(if (re-matches re-number value) [(read-string value) remainder]))</pre></td></tr><tr><td class="docs"><p>Parse a token assumed to be the name of a property of the current cell,
|
||||
(if (and value (re-matches re-number value)) [(read-string value) remainder]))</pre></td></tr><tr><td class="docs"><p>Parse a token assumed to be the name of a property of the current cell,
|
||||
whose value is assumed to be an integer.</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn parse-property-int
|
||||
[[value & remainder]]
|
||||
|
@ -3217,7 +3217,7 @@ front of the sequence of tokens it returns nil.</p>
|
|||
comparator (cond (= MORE "more") '>
|
||||
(member? MORE '("fewer" "less")) '<)]
|
||||
(cond
|
||||
(not (= WITHIN "within"))
|
||||
(not= WITHIN "within")
|
||||
(parse-comparator-neighbours-condition
|
||||
(flatten
|
||||
;; two tokens were mis-parsed as 'within distance' that weren't
|
||||
|
@ -3256,7 +3256,7 @@ front of the sequence of tokens it returns nil.</p>
|
|||
(cond
|
||||
(and quantity (= NEIGHBOURS "neighbours"))
|
||||
(cond
|
||||
(not (= WITHIN "within"))
|
||||
(not= WITHIN "within")
|
||||
(parse-simple-neighbours-condition
|
||||
(flatten
|
||||
;; two tokens were mis-parsed as 'within distance' that weren't
|
||||
|
@ -3325,7 +3325,7 @@ front of the sequence of tokens it returns nil.</p>
|
|||
</td><td class="codes"><pre class="brush: clojure">(defn- parse-arithmetic-action
|
||||
[previous [prop1 SHOULD BE prop2 operator value & rest]]
|
||||
(cond
|
||||
(member? prop2 '("x" "y"))
|
||||
(member? prop1 '("x" "y"))
|
||||
(throw
|
||||
(Exception. reserved-properties-error))
|
||||
(and (= SHOULD "should")
|
||||
|
|
|
@ -3157,7 +3157,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
|||
(compiler/compile-file
|
||||
(io/get-resource "/rulesets/basic.txt")))
|
||||
(session/get :rules)))
|
||||
generation (+ (or (session/get :generation) 0) 1)
|
||||
generation (inc (or (session/get :generation) 0))
|
||||
w2 (engine/transform-world world rules)
|
||||
]
|
||||
(session/put! :world w2)
|
||||
|
@ -3167,7 +3167,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
|||
(cons :table
|
||||
(map render-world-row w2)))
|
||||
[:p
|
||||
(str "Generation " generation)]]))</pre></td></tr><tr><td class="docs">
|
||||
(str "Generation " generation)]]))</pre></td></tr><tr><td class="docs"><p>Render in Hiccup format the HTML content of an inspector on this cell.</p>
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn render-inspector
|
||||
[cell table]
|
||||
[:table {:class "music-ruled"}
|
||||
|
@ -3229,8 +3229,8 @@ net.brehaut.ClojureTools = (function (SH) {
|
|||
(let [params (keywordize-keys (:params request))
|
||||
xs (:x params)
|
||||
ys (:y params)
|
||||
x (if (not (empty? xs)) (read-string xs) 0)
|
||||
y (if (not (empty? ys)) (read-string ys) 0)
|
||||
x (if (seq xs) (read-string xs) 0)
|
||||
y (if (seq ys) (read-string ys) 0)
|
||||
world (session/get :world)
|
||||
cell (engine-utils/get-cell world x y)
|
||||
state (:state params)]
|
||||
|
@ -3267,7 +3267,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
|||
:content (util/md->html (str "/md/" content))})))</pre></td></tr><tr><td class="docs">
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn list-states []
|
||||
(sort
|
||||
(filter #(not (nil? %))
|
||||
(remove nil?
|
||||
(map #(first (rest (re-matches #"([0-9a-z-]+).png" (.getName %))))
|
||||
(file-seq (clojure.java.io/file "resources/public/img/tiles"))))))</pre></td></tr><tr><td class="docs">
|
||||
</td><td class="codes"><pre class="brush: clojure">(defn docs-page []
|
||||
|
@ -3318,15 +3318,14 @@ net.brehaut.ClojureTools = (function (SH) {
|
|||
pause (:pause params)
|
||||
rulefile (:ruleset params)
|
||||
rulepath (str "/rulesets/" rulefile ".txt")]
|
||||
(if (not (= map ""))
|
||||
(if (not= map "")
|
||||
(session/put! :world
|
||||
(heightmap/apply-heightmap
|
||||
(io/get-resource (str "/img/heightmaps/" map ".png")))))
|
||||
(if (not (= rulefile ""))
|
||||
(do
|
||||
(session/put! :rule-text (io/slurp-resource rulepath))
|
||||
(session/put! :rules (compiler/compile-file (io/get-resource rulepath)))))
|
||||
(if (not (= pause ""))
|
||||
(when (not= rulefile "")
|
||||
(session/put! :rule-text (io/slurp-resource rulepath))
|
||||
(session/put! :rules (compiler/compile-file (io/get-resource rulepath))))
|
||||
(if (not= pause "")
|
||||
(session/put! :pause pause))
|
||||
(layout/render "params.html"
|
||||
(merge (send-params)
|
||||
|
@ -3404,7 +3403,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
|||
[path (str (io/resource-path) directory)]
|
||||
(session/put! :list-resources-path path)
|
||||
(sort
|
||||
(filter #(not (nil? %))
|
||||
(remove nil?
|
||||
(map #(first (rest (re-matches pattern (.getName %))))
|
||||
(file-seq (clojure.java.io/file path)))))))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">Marginalia</a>. Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;
|
||||
SyntaxHighlighter.all()</script></body></html>
|
|
@ -47,7 +47,7 @@
|
|||
(compiler/compile-file
|
||||
(io/get-resource "/rulesets/basic.txt")))
|
||||
(session/get :rules)))
|
||||
generation (+ (or (session/get :generation) 0) 1)
|
||||
generation (inc (or (session/get :generation) 0))
|
||||
w2 (engine/transform-world world rules)
|
||||
]
|
||||
(session/put! :world w2)
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
(let [params (keywordize-keys (:params request))
|
||||
xs (:x params)
|
||||
ys (:y params)
|
||||
x (if (not (empty? xs)) (read-string xs) 0)
|
||||
y (if (not (empty? ys)) (read-string ys) 0)
|
||||
x (if (seq xs) (read-string xs) 0)
|
||||
y (if (seq ys) (read-string ys) 0)
|
||||
world (session/get :world)
|
||||
cell (engine-utils/get-cell world x y)
|
||||
state (:state params)]
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
(defn list-states []
|
||||
(sort
|
||||
(filter #(not (nil? %))
|
||||
(remove nil?
|
||||
(map #(first (rest (re-matches #"([0-9a-z-]+).png" (.getName %))))
|
||||
(file-seq (clojure.java.io/file "resources/public/img/tiles"))))))
|
||||
|
||||
|
|
|
@ -31,15 +31,14 @@
|
|||
pause (:pause params)
|
||||
rulefile (:ruleset params)
|
||||
rulepath (str "/rulesets/" rulefile ".txt")]
|
||||
(if (not (= map ""))
|
||||
(if (not= map "")
|
||||
(session/put! :world
|
||||
(heightmap/apply-heightmap
|
||||
(io/get-resource (str "/img/heightmaps/" map ".png")))))
|
||||
(if (not (= rulefile ""))
|
||||
(do
|
||||
(session/put! :rule-text (io/slurp-resource rulepath))
|
||||
(session/put! :rules (compiler/compile-file (io/get-resource rulepath)))))
|
||||
(if (not (= pause ""))
|
||||
(when (not= rulefile "")
|
||||
(session/put! :rule-text (io/slurp-resource rulepath))
|
||||
(session/put! :rules (compiler/compile-file (io/get-resource rulepath))))
|
||||
(if (not= pause "")
|
||||
(session/put! :pause pause))
|
||||
(layout/render "params.html"
|
||||
(merge (send-params)
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
[path (str (io/resource-path) directory)]
|
||||
(session/put! :list-resources-path path)
|
||||
(sort
|
||||
(filter #(not (nil? %))
|
||||
(remove nil?
|
||||
(map #(first (rest (re-matches pattern (.getName %))))
|
||||
(file-seq (clojure.java.io/file path)))))))
|
||||
|
|
Loading…
Reference in a new issue