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