Serious work on the buildall script (and project.clj) to capture a
build signature in the MANIFEST.MF file.
This commit is contained in:
parent
b5e28496f3
commit
529731e5f1
|
@ -1,6 +1,14 @@
|
||||||
(defproject mw-ui "0.1.2-SNAPSHOT"
|
(defproject mw-ui "0.1.2-SNAPSHOT"
|
||||||
:description "Web-based user interface for MicroWorld"
|
:description "Web-based user interface for MicroWorld"
|
||||||
:url "http://www.journeyman.cc/microworld"
|
:url "http://www.journeyman.cc/microworld"
|
||||||
|
:manifest {
|
||||||
|
;; do not reformat this! It is important for the buildall script
|
||||||
|
;; that each of these properties is on a line with nothing else.
|
||||||
|
"build-signature-version" "unset"
|
||||||
|
"build-signature-user" "unset"
|
||||||
|
"build-signature-email" "unset"
|
||||||
|
"build-signature-timestamp" "unset"
|
||||||
|
}
|
||||||
:dependencies [[org.clojure/clojure "1.6.0"]
|
:dependencies [[org.clojure/clojure "1.6.0"]
|
||||||
[mw-engine "0.1.2-SNAPSHOT"]
|
[mw-engine "0.1.2-SNAPSHOT"]
|
||||||
[mw-parser "0.1.2-SNAPSHOT"]
|
[mw-parser "0.1.2-SNAPSHOT"]
|
||||||
|
|
|
@ -3029,7 +3029,7 @@ net.brehaut.ClojureTools = (function (SH) {
|
||||||
};
|
};
|
||||||
})(SyntaxHighlighter);
|
})(SyntaxHighlighter);
|
||||||
</script><title>mw-engine -- Marginalia</title></head><body><table><tr><td class="docs"><div class="header"><h1 class="project-name">mw-engine</h1><h2 class="project-version">0.1.2-SNAPSHOT</h2><br /><p>Cellular automaton world builder.</p>
|
</script><title>mw-engine -- Marginalia</title></head><body><table><tr><td class="docs"><div class="header"><h1 class="project-name">mw-engine</h1><h2 class="project-version">0.1.2-SNAPSHOT</h2><br /><p>Cellular automaton world builder.</p>
|
||||||
</div><div class="dependencies"><h3>dependencies</h3><table><tr><td class="dep-name">org.clojure/clojure</td><td class="dotted"><hr /></td><td class="dep-version">1.5.1</td></tr><tr><td class="dep-name">org.clojure/math.combinatorics</td><td class="dotted"><hr /></td><td class="dep-version">0.0.7</td></tr><tr><td class="dep-name">org.clojure/tools.trace</td><td class="dotted"><hr /></td><td class="dep-version">0.7.8</td></tr><tr><td class="dep-name">net.mikera/imagez</td><td class="dotted"><hr /></td><td class="dep-version">0.3.1</td></tr><tr><td class="dep-name">fivetonine/collage</td><td class="dotted"><hr /></td><td class="dep-version">0.2.1</td></tr></table></div></td><td class="codes" style="text-align: center; vertical-align: middle;color: #666;padding-right:20px"><br /><br /><br />(this space intentionally left almost blank)</td></tr><tr><td class="docs"><div class="toc"><a name="toc"><h3>namespaces</h3></a><ul><li><a href="#mw-engine.core">mw-engine.core</a></li><li><a href="#mw-engine.heightmap">mw-engine.heightmap</a></li><li><a href="#mw-engine.natural-rules">mw-engine.natural-rules</a></li><li><a href="#mw-engine.utils">mw-engine.utils</a></li><li><a href="#mw-engine.world">mw-engine.world</a></li></ul></div></td><td class="codes"> </td></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.core" name="mw-engine.core"><h1 class="project-name">mw-engine.core</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>Functions to transform a world and run rules.</p>
|
</div><div class="dependencies"><h3>dependencies</h3><table><tr><td class="dep-name">org.clojure/clojure</td><td class="dotted"><hr /></td><td class="dep-version">1.5.1</td></tr><tr><td class="dep-name">org.clojure/math.combinatorics</td><td class="dotted"><hr /></td><td class="dep-version">0.0.7</td></tr><tr><td class="dep-name">org.clojure/tools.trace</td><td class="dotted"><hr /></td><td class="dep-version">0.7.8</td></tr><tr><td class="dep-name">net.mikera/imagez</td><td class="dotted"><hr /></td><td class="dep-version">0.3.1</td></tr></table></div></td><td class="codes" style="text-align: center; vertical-align: middle;color: #666;padding-right:20px"><br /><br /><br />(this space intentionally left almost blank)</td></tr><tr><td class="docs"><div class="toc"><a name="toc"><h3>namespaces</h3></a><ul><li><a href="#mw-engine.core">mw-engine.core</a></li><li><a href="#mw-engine.heightmap">mw-engine.heightmap</a></li><li><a href="#mw-engine.manifest">mw-engine.manifest</a></li><li><a href="#mw-engine.natural-rules">mw-engine.natural-rules</a></li><li><a href="#mw-engine.utils">mw-engine.utils</a></li><li><a href="#mw-engine.world">mw-engine.world</a></li></ul></div></td><td class="codes"> </td></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.core" name="mw-engine.core"><h1 class="project-name">mw-engine.core</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>Functions to transform a world and run rules.</p>
|
||||||
</td><td class="codes"></td></tr><tr><td class="docs">
|
</td><td class="codes"></td></tr><tr><td class="docs">
|
||||||
</td><td class="codes"><pre class="brush: clojure">(ns mw-engine.core
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-engine.core
|
||||||
(:use mw-engine.utils)
|
(:use mw-engine.utils)
|
||||||
|
@ -3118,11 +3118,8 @@ ignored). Darker shades are higher.</p>
|
||||||
(:import [java.awt.image BufferedImage])
|
(:import [java.awt.image BufferedImage])
|
||||||
(:use mw-engine.utils
|
(:use mw-engine.utils
|
||||||
mw-engine.world
|
mw-engine.world
|
||||||
;; interestingly the imagez load-image is failing for me, while the
|
[mikera.image.core :only [load-image filter-image get-pixels]]
|
||||||
;; collage version is problem free.
|
[mikera.image.filters]))</pre></td></tr><tr><td class="docs"><p>Surprisingly, Clojure doesn't seem to have an abs function, or else I've
|
||||||
[mikera.image.core :only [filter-image get-pixels]]
|
|
||||||
[mikera.image.filters]
|
|
||||||
[fivetonine.collage.util]))</pre></td></tr><tr><td class="docs"><p>Surprisingly, Clojure doesn't seem to have an abs function, or else I've
|
|
||||||
missed it. So here's one of my own. Maps natural numbers onto themselves,
|
missed it. So here's one of my own. Maps natural numbers onto themselves,
|
||||||
and negative integers onto natural numbers. Also maps negative real numbers
|
and negative integers onto natural numbers. Also maps negative real numbers
|
||||||
onto positive real numbers.</p>
|
onto positive real numbers.</p>
|
||||||
|
@ -3156,9 +3153,9 @@ ignored). Darker shades are higher.</p>
|
||||||
<li><code>heightmap</code> an (ideally) greyscale image, whose x and y dimensions should
|
<li><code>heightmap</code> an (ideally) greyscale image, whose x and y dimensions should
|
||||||
exceed those of the world of which the <code>cell</code> forms part.</li>
|
exceed those of the world of which the <code>cell</code> forms part.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn transform-altitude
|
</td><td class="codes"><pre class="brush: clojure">(defn tag-altitude
|
||||||
([world cell heightmap]
|
([world cell heightmap]
|
||||||
(transform-altitude cell heightmap))
|
(tag-altitude cell heightmap))
|
||||||
([cell heightmap]
|
([cell heightmap]
|
||||||
(merge cell
|
(merge cell
|
||||||
{:altitude
|
{:altitude
|
||||||
|
@ -3179,17 +3176,28 @@ a world the size of the heightmap will be created.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td><td class="codes"><pre class="brush: clojure">(defn apply-heightmap
|
</td><td class="codes"><pre class="brush: clojure">(defn apply-heightmap
|
||||||
([world imagepath]
|
([world imagepath]
|
||||||
;; bizarrely, the collage load-util is working for me, but the imagez version isn't.
|
|
||||||
(let [heightmap (filter-image (grayscale)(load-image imagepath))]
|
(let [heightmap (filter-image (grayscale)(load-image imagepath))]
|
||||||
(map-world
|
(map-world
|
||||||
(map-world world transform-altitude (list heightmap))
|
(map-world world tag-altitude (list heightmap))
|
||||||
tag-gradient)))
|
tag-gradient)))
|
||||||
([imagepath]
|
([imagepath]
|
||||||
(let [heightmap (filter-image (grayscale)(load-image imagepath))
|
(let [heightmap (filter-image (grayscale)(load-image imagepath))
|
||||||
world (make-world (.getWidth heightmap) (.getHeight heightmap))]
|
world (make-world (.getWidth heightmap) (.getHeight heightmap))]
|
||||||
(map-world
|
(map-world
|
||||||
(map-world world transform-altitude (list heightmap))
|
(map-world world tag-altitude (list heightmap))
|
||||||
tag-gradient))))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.natural-rules" name="mw-engine.natural-rules"><h1 class="project-name">mw-engine.natural-rules</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>A set of MicroWorld rules describing a simplified natural ecosystem.</p>
|
tag-gradient))))</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.manifest" name="mw-engine.manifest"><h1 class="project-name">mw-engine.manifest</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>manifest.clj: a mechanism </p>
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(ns mw-engine.manifest)</pre></td></tr><tr><td class="docs">
|
||||||
|
</td><td class="codes"><pre class="brush: clojure">(def manifest {
|
||||||
|
:build-signature {
|
||||||
|
:build-signture-version "0.1.2-SNAPSHOT"
|
||||||
|
:build-signature-user "unset"
|
||||||
|
:build-signature-email "unset"
|
||||||
|
:build-signature-timestamp "unset"
|
||||||
|
;; NOTE: it's important that the closing brace not be on the same
|
||||||
|
;; line as the build-signature fields, because of how the buildall
|
||||||
|
;; script constructs the build signature.
|
||||||
|
}
|
||||||
|
})</pre></td></tr><tr><td class="spacer docs"> </td><td class="codes" /></tr><tr><td class="docs"><div class="docs-header"><a class="anchor" href="#mw-engine.natural-rules" name="mw-engine.natural-rules"><h1 class="project-name">mw-engine.natural-rules</h1><a class="toc-link" href="#toc">toc</a></a></div></td><td class="codes" /></tr><tr><td class="docs"><p>A set of MicroWorld rules describing a simplified natural ecosystem.</p>
|
||||||
|
|
||||||
<p>Since the completion of the rule language this is more or less obsolete -
|
<p>Since the completion of the rule language this is more or less obsolete -
|
||||||
there are still a few things that you can do with rules written in Clojure
|
there are still a few things that you can do with rules written in Clojure
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
## Ruleset which attempts to model retreat of ice after an iceage
|
## Ruleset which attempts to model retreat of ice after an iceage
|
||||||
|
|
||||||
;; Limitations: because the rule language doesn't (yet) allow sophisticated
|
;; Limitations: because the rule language doesn't (yet) allow sophisticated
|
||||||
;; arithmetic, the ice retreats north to south (southern hemisphere).
|
;; arithmetic, the ice retreats north to south (southern hemisphere). Otherwise,
|
||||||
|
;; it's pretty realistic; ice moves progressively up hillsides, and vegetation
|
||||||
|
;; gradually re-establishes.
|
||||||
|
|
||||||
## Vegetation rules
|
## Vegetation rules
|
||||||
;; rules which populate the world with plants
|
;; rules which populate the world with plants
|
||||||
|
@ -55,9 +57,9 @@ if state is new then state should be ice
|
||||||
;; just a hack because I can't do complex arithmetic in rules)
|
;; just a hack because I can't do complex arithmetic in rules)
|
||||||
;; below the waterline ice thaws to water.
|
;; below the waterline ice thaws to water.
|
||||||
if state is ice and generation is more than y and altitude is less than 10 then state should be water
|
if state is ice and generation is more than y and altitude is less than 10 then state should be water
|
||||||
|
|
||||||
;; otherwise it thaws to snow
|
;; otherwise it thaws to snow
|
||||||
if state is ice and generation is more than y then state should be snow
|
if state is ice and generation is more than y then state should be snow
|
||||||
|
|
||||||
;; thaw moves gradually up the hills
|
;; thaw moves gradually up the hills
|
||||||
|
|
||||||
if state is snow and generation is more than altitude then state should be waste
|
if state is snow and generation is more than altitude then state should be waste
|
||||||
|
|
|
@ -7,9 +7,15 @@
|
||||||
|
|
||||||
;; The universe of the Game of Life is an infinite two-dimensional orthogonal
|
;; The universe of the Game of Life is an infinite two-dimensional orthogonal
|
||||||
;; grid of square cells, each of which is in one of two possible states, alive
|
;; grid of square cells, each of which is in one of two possible states, alive
|
||||||
;; or dead. Every cell interacts with its eight neighbours, which are the
|
;; or dead, represented in this ruleset by 'black' and 'white' respectively.
|
||||||
;; cells that are horizontally, vertically, or diagonally adjacent. At each
|
;; Every cell interacts with its eight neighbours, which are the
|
||||||
;; step in time, the following transitions occur:
|
;; cells that are horizontally, vertically, or diagonally adjacent.
|
||||||
|
|
||||||
|
;; Although this ruleset is superficially simple, it runs very slowly, because
|
||||||
|
;; all the rules depend on neighbours, which makes them more expensive to
|
||||||
|
;; compute.
|
||||||
|
|
||||||
|
;; At each step in time, the following transitions occur:
|
||||||
|
|
||||||
;; Any live cell with fewer than two live neighbours dies, as if caused by
|
;; Any live cell with fewer than two live neighbours dies, as if caused by
|
||||||
;; under-population.
|
;; under-population.
|
||||||
|
|
|
@ -1,25 +1,51 @@
|
||||||
|
# Human settlement
|
||||||
|
|
||||||
|
;; This rule set attempts to model human settlement in a landscape. It models
|
||||||
|
;; western European pre-history moderately well. Settlement first occurs as
|
||||||
|
;; nomadic camps on coastal promentaries (cells with four or more neighbours
|
||||||
|
;; that are water). This represents 'kitchen-midden' mesolithic settlement.
|
||||||
|
;;
|
||||||
|
;; As grassland becomes available near camps, pastoralists appear, and will
|
||||||
|
;; follow their herds inland. When pastoralists have available fertile land,
|
||||||
|
;; they will till the soil and plant crops, and in doing so will establish
|
||||||
|
;; permanent settlements; this is approximately a neolithic stage.
|
||||||
|
;;
|
||||||
|
;; Where soil is fertile, settlements will cluster, and markets will appear.
|
||||||
|
;; where there is sufficient settlement, the markets become permanent, and you
|
||||||
|
;; have the appearance of towns. This takes us roughly into the bronze age.
|
||||||
|
;;
|
||||||
|
;; This is quite a complex ruleset, and runs quite slowly. However, it does
|
||||||
|
;; model some significant things. Soil gains in fertility under woodland; deep
|
||||||
|
;; loams and podzols build up over substantial time. Agriculture depletes
|
||||||
|
;; fertility. So if forest has become well established before human settlement
|
||||||
|
;; begins, a higher population (more crops) will eventually be sustainable,
|
||||||
|
;; whereas if human population starts early the deep fertile soils will not
|
||||||
|
;; establish and you will have more pastoralism, supporting fewer permanent
|
||||||
|
;; settlements.
|
||||||
|
|
||||||
;; hack to speed up processing on the 'great britain and ireland' map
|
;; hack to speed up processing on the 'great britain and ireland' map
|
||||||
if state is water then state should be water
|
if state is water then state should be water
|
||||||
|
|
||||||
# Human settlement
|
|
||||||
|
|
||||||
;; nomads make their first significant camp near water because of fish and
|
;; nomads make their first significant camp near water because of fish and
|
||||||
;; shellfish (kitchen-midden people)
|
;; shellfish (kitchen-midden people)
|
||||||
if state is in grassland or heath and more than 3 neighbours are water and generation is more than 20 then state should be camp
|
if state is in grassland or heath and more than 3 neighbours are water and generation is more than 20 then state should be camp
|
||||||
|
|
||||||
;; sooner or later nomads learn to keep flocks
|
;; sooner or later nomads learn to keep flocks
|
||||||
if state is in grassland or heath and some neighbours are camp then state should be pasture
|
if state is in grassland or heath and some neighbours are camp then 1 chance in 2 state should be pasture
|
||||||
|
|
||||||
;; and more herds support more people
|
;; and more herds support more people
|
||||||
if state is in grassland or heath and more than 2 neighbours are pasture then state should be camp
|
if state is in grassland or heath and more than 2 neighbours are pasture then 1 chance in 3 state should be camp
|
||||||
if state is pasture and more than 3 neighbours are pasture and fewer than 1 neighbours are camp and fewer than 1 neighbours within 2 are house then state should be camp
|
if state is pasture and more than 3 neighbours are pasture and fewer than 1 neighbours are camp and fewer than 1 neighbours within 2 are house then state should be camp
|
||||||
|
|
||||||
;; the idea of agriculture spreads
|
;; the idea of agriculture spreads
|
||||||
if state is in grassland or heath and some neighbours within 3 are house then state should be pasture
|
if state is in grassland or heath and some neighbours within 2 are house then state should be pasture
|
||||||
|
|
||||||
;; nomads don't move on while the have crops growing. That would be silly!
|
;; nomads don't move on while the have crops growing. That would be silly!
|
||||||
if state is camp and some neighbours are ploughland then state should be camp
|
if state is camp and some neighbours are ploughland then state should be camp
|
||||||
|
|
||||||
|
;; Impoverished pasture can't be grazed permanently
|
||||||
|
if state is pasture and fertility is less than 2 then 1 chance in 3 state should be heath
|
||||||
|
|
||||||
;; nomads move on
|
;; nomads move on
|
||||||
if state is camp then 1 chance in 5 state should be waste
|
if state is camp then 1 chance in 5 state should be waste
|
||||||
|
|
||||||
|
@ -128,4 +154,3 @@ if state is new and altitude is more than 200 then state should be snow
|
||||||
;; otherwise, we have grassland.
|
;; otherwise, we have grassland.
|
||||||
if state is new then state should be grassland
|
if state is new then state should be grassland
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<h2>Implemented states</h2>
|
<h2>Implemented states</h2>
|
||||||
<p>As it says in the rule language documentation, above, you can use
|
<p>As it says in the rule language documentation, above, you can use
|
||||||
any sequence of alphanumeric characters you want as the name of a state
|
any sequence of alphanumeric characters you want as the name of a state
|
||||||
&emdash; you can call it whatever you like. However, if you use state
|
- you can call it whatever you like. However, if you use state
|
||||||
names that there aren't already tiles for, and aren't already classes
|
names that there aren't already tiles for, and aren't already classes
|
||||||
for in the CSS file, your states won't be displayed nicely in the
|
for in the CSS file, your states won't be displayed nicely in the
|
||||||
<a href="{{servlet-context}}/">World</a> display. The states for which
|
<a href="{{servlet-context}}/">World</a> display. The states for which
|
||||||
|
|
Loading…
Reference in a new issue