diff --git a/project.clj b/project.clj index 609e3e1..8d3439c 100644 --- a/project.clj +++ b/project.clj @@ -1,6 +1,14 @@ (defproject mw-ui "0.1.2-SNAPSHOT" :description "Web-based user interface for 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"] [mw-engine "0.1.2-SNAPSHOT"] [mw-parser "0.1.2-SNAPSHOT"] diff --git a/resources/public/docs/mw-engine/uberdoc.html b/resources/public/docs/mw-engine/uberdoc.html index c175a03..be4b6d6 100644 --- a/resources/public/docs/mw-engine/uberdoc.html +++ b/resources/public/docs/mw-engine/uberdoc.html @@ -3029,7 +3029,7 @@ net.brehaut.ClojureTools = (function (SH) { }; })(SyntaxHighlighter);
mw-engine0.1.2-SNAPSHOTCellular automaton world builder. -dependencies
| (this space intentionally left almost blank) | |||||||||||||||
Functions to transform a world and run rules. +dependencies
| (this space intentionally left almost blank) | |||||||||||||||
Functions to transform a world and run rules. | ||||||||||||||||
(ns mw-engine.core (:use mw-engine.utils) @@ -3118,11 +3118,8 @@ ignored). Darker shades are higher. (:import [java.awt.image BufferedImage]) (:use mw-engine.utils mw-engine.world - ;; interestingly the imagez load-image is failing for me, while the - ;; collage version is problem free. - [mikera.image.core :only [filter-image get-pixels]] - [mikera.image.filters] - [fivetonine.collage.util])) | ||||||||||||||||
Surprisingly, Clojure doesn't seem to have an abs function, or else I've + [mikera.image.core :only [load-image filter-image get-pixels]] + [mikera.image.filters])) | ||||||||||||||||
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, and negative integers onto natural numbers. Also maps negative real numbers onto positive real numbers. @@ -3156,9 +3153,9 @@ ignored). Darker shades are higher.heightmap an (ideally) greyscale image, whose x and y dimensions should
exceed those of the world of which the cell forms part. | (defn transform-altitude + | (defn tag-altitude ([world cell heightmap] - (transform-altitude cell heightmap)) + (tag-altitude cell heightmap)) ([cell heightmap] (merge cell {:altitude @@ -3179,17 +3176,28 @@ a world the size of the heightmap will be created. | (defn apply-heightmap ([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))] (map-world - (map-world world transform-altitude (list heightmap)) + (map-world world tag-altitude (list heightmap)) tag-gradient))) ([imagepath] (let [heightmap (filter-image (grayscale)(load-image imagepath)) world (make-world (.getWidth heightmap) (.getHeight heightmap))] (map-world - (map-world world transform-altitude (list heightmap)) - tag-gradient)))) | |||||||||||||
A set of MicroWorld rules describing a simplified natural ecosystem. + (map-world world tag-altitude (list heightmap)) + tag-gradient)))) | ||||||||||||||||
manifest.clj: a mechanism + | (ns mw-engine.manifest) | |||||||||||||||
+ | (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. + } + }) | |||||||||||||||
A set of MicroWorld rules describing a simplified natural ecosystem. 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 diff --git a/resources/public/rulesets/iceage.txt b/resources/public/rulesets/iceage.txt index b83d904..4db944e 100644 --- a/resources/public/rulesets/iceage.txt +++ b/resources/public/rulesets/iceage.txt @@ -1,7 +1,9 @@ ## Ruleset which attempts to model retreat of ice after an iceage ;; 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 ;; 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) ;; 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 + ;; otherwise it thaws to snow if state is ice and generation is more than y then state should be snow ;; thaw moves gradually up the hills - if state is snow and generation is more than altitude then state should be waste diff --git a/resources/public/rulesets/life.txt b/resources/public/rulesets/life.txt index d290d6d..6ca12fe 100644 --- a/resources/public/rulesets/life.txt +++ b/resources/public/rulesets/life.txt @@ -7,9 +7,15 @@ ;; 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 -;; or dead. Every cell interacts with its eight neighbours, which are the -;; cells that are horizontally, vertically, or diagonally adjacent. At each -;; step in time, the following transitions occur: +;; or dead, represented in this ruleset by 'black' and 'white' respectively. +;; Every cell interacts with its eight neighbours, which are the +;; 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 ;; under-population. diff --git a/resources/public/rulesets/settlement.txt b/resources/public/rulesets/settlement.txt index 259d9d4..f31f7b3 100644 --- a/resources/public/rulesets/settlement.txt +++ b/resources/public/rulesets/settlement.txt @@ -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 if state is water then state should be water -# Human settlement - ;; nomads make their first significant camp near water because of fish and ;; 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 ;; 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 -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 ;; 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! 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 if state is camp then 1 chance in 5 state should be waste @@ -127,5 +153,4 @@ if state is new and altitude is more than 200 then state should be snow ;; otherwise, we have grassland. if state is new then state should be grassland - \ No newline at end of file diff --git a/resources/templates/docs.html b/resources/templates/docs.html index 82116dc..1b9cb34 100644 --- a/resources/templates/docs.html +++ b/resources/templates/docs.html @@ -25,7 +25,7 @@ Implemented statesAs it says in the rule language documentation, above, you can use 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 for in the CSS file, your states won't be displayed nicely in the World display. The states for which |