diff --git a/resources/public/docs/mw-parser/uberdoc.html b/resources/public/docs/mw-parser/uberdoc.html index e7b0e9f..9a00606 100644 --- a/resources/public/docs/mw-parser/uberdoc.html +++ b/resources/public/docs/mw-parser/uberdoc.html @@ -3162,7 +3162,7 @@ front of the sequence of tokens it returns nil.

([tokens expect-int] (or (parse-disjunct-value tokens expect-int) - (parse-simple-value tokens))) + (parse-simple-value tokens expect-int))) ([tokens] (parse-value tokens false)))

Parses a condition of the form '[property] in [value] or [value]...'

(defn parse-member-condition
diff --git a/resources/public/img/tiles/abandoned.png b/resources/public/img/tiles/abandoned.png
new file mode 100644
index 0000000..1492e7e
Binary files /dev/null and b/resources/public/img/tiles/abandoned.png differ
diff --git a/resources/public/img/tiles/inn.png b/resources/public/img/tiles/inn.png
new file mode 100644
index 0000000..67cbf58
Binary files /dev/null and b/resources/public/img/tiles/inn.png differ
diff --git a/resources/public/img/tiles/plague.png b/resources/public/img/tiles/plague.png
new file mode 100644
index 0000000..4235d08
Binary files /dev/null and b/resources/public/img/tiles/plague.png differ
diff --git a/resources/rulesets/settlement.txt b/resources/rulesets/settlement.txt
new file mode 100644
index 0000000..df21d8b
--- /dev/null
+++ b/resources/rulesets/settlement.txt
@@ -0,0 +1,116 @@
+# 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 meadow
+
+;; and more herds support more people
+if state is in grassland or heath and more than 2 neighbours are meadow then state should be camp
+if state is meadow and more than 3 neighbours are meadow and 
+
+;; the idea of agriculture spreads
+if state is in grassland or heath and some neighbours are meadow and some neighbours within 3 are house then state should be meadow
+
+;; nomads move on
+if state is camp then 1 chance in 5 state should be waste
+
+;; meadow that's too far from a house or camp will be abandoned
+if state is meadow and fewer than 1 neighbours within 3 are house and fewer than 1 neighbours within 2 are camp then state should be heath
+
+;; good fertile pasture close to settlement will be ploughed for crops
+if state is meadow and fertility is more than 10 and altitude is less than 100 and some neighbours are camp or some neighbours are house then state should be ploughland
+
+if state is ploughland then state should be crop
+
+;; after the crop is harvested, the land is allowed to lie fallow
+if state is crop then state should be grassland
+
+;; if there's reliable food available, nomads build permanent settlements
+if state is in camp or abandoned and some neighbours are crop then state should be house
+;; people camp near to markets
+if state is in waste or grassland and some neighbours are market then state should be camp
+
+;; markets spring up near settlements
+if state is meadow and more than 1 neighbours are house then 1 chance in 10 state should be market
+
+;; a market in a settlement survives
+if state is market and more than 3 neighbours are house then state should be market
+if state is market and some neighbours are inn then state should be market
+if state is market then state should be grassland
+
+;; a house near a market in a settlement will become an inn
+if state is house and some neighbours are market and more than 1 neighbours are house then state should be inn
+;; but it will need some local custom to survive
+if state is inn and fewer than 2 neighbours are house then state should be house
+
+;; if there aren't enough resources houses should be abandoned
+;; resources from fishing
+if state is house and more than 2 neighbours are water then state should be house
+;; from farming
+if state is house and some neighbours are meadow then state should be house
+if state is house and some neighbours are crop then state should be house
+;; from the market
+if state is house and some neighbours are market then state should be house
+if state is house then 1 chance in 2 state should be abandoned
+if state is abandoned then 1 chance in 5 state should be waste  
+
+
+## Vegetation rules
+;; rules which populate the world with plants
+
+;; Occasionally, passing birds plant tree seeds into grassland 
+
+if state is grassland then 1 chance in 10 state should be heath
+
+;; heath below the treeline grows gradually into forest, providing browsing pressure is not to high
+
+if state is heath and deer are fewer than 6 and altitude is less than 150 then state should be scrub 
+if state is scrub then 1 chance in 5 state should be forest
+
+;; Forest on fertile land grows to climax
+
+if state is forest and fertility is more than 5 then state should be climax   
+    
+;; Climax forest occasionally catches fire (e.g. lightning strikes)
+
+if state is climax then 1 chance in 500 state should be fire
+
+;; Climax forest neighbouring fires is likely to catch fire. So are buildings.
+if state is in climax or camp or house or inn and some neighbours are fire then 1 chance in 3 state should be fire
+
+;; After fire we get waste
+
+if state is fire then state should be waste
+
+;; And after waste we get pioneer species; if there's a woodland seed
+;; source, it's going to be heath, otherwise grassland.
+
+if state is waste and some neighbours are scrub then state should be heath
+if state is waste and some neighbours are forest then state should be heath
+if state is waste and some neighbours are climax then state should be heath
+if state is waste then state should be grassland
+
+
+## Potential blockers
+
+;; Forest increases soil fertility. 
+if state is in forest or climax then fertility should be fertility + 1
+
+## Initialisation rules
+
+;; Rules which deal with state 'new' will waste less time if they're near the
+;; end of the file
+
+;; below the waterline we have water.
+
+if state is new and altitude is less than 10 then state should be water
+
+;; above the snowline we have snow.
+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
+
diff --git a/resources/templates/rules.html b/resources/templates/rules.html
index 9eaf279..24ac35d 100644
--- a/resources/templates/rules.html
+++ b/resources/templates/rules.html
@@ -4,9 +4,6 @@
 	
-	{% if error %}
-	

{{error}}

- {% endif %}

diff --git a/src/mw_ui/render_world.clj b/src/mw_ui/render_world.clj index 896b1d1..15af785 100644 --- a/src/mw_ui/render_world.clj +++ b/src/mw_ui/render_world.clj @@ -28,7 +28,7 @@ (let [state (:state cell)] [:td {:class (format-css-class state) :title (format-mouseover cell)} [:a {:href (format "inspect?x=%d&y=%d" (:x cell) (:y cell))} - [:img {:alt (world/format-cell cell) :src (format-image-path state)}]]])) + [:img {:alt (:state cell) :src (format-image-path state)}]]])) (defn render-world-row "Render this world row as a Hiccup table row." @@ -41,8 +41,8 @@ (let [world (or (session/get :world) (engine/transform-world (heightmap/apply-heightmap - ;;"resources/public/img/20x20/hill.png" - "resources/public/img/heightmaps/great_britain_and_ireland_small.png" + "resources/public/img/20x20/hill.png" + ;; "resources/public/img/heightmaps/great_britain_and_ireland_small.png" ) rules/init-rules)) rules (or (session/get :rules)