# HG changeset patch # User Steve Losh # Date 1450110676 0 # Node ID 57ce46be0449947a7a08984c88366b7d1f4fb4e4 # Parent 4dccbc0c808ad98a30571f8cf18c69a96b61fb74 Water damps temperature loss diff -r 4dccbc0c808a -r 57ce46be0449 README.markdown --- a/README.markdown Mon Dec 14 16:13:27 2015 +0000 +++ b/README.markdown Mon Dec 14 16:31:16 2015 +0000 @@ -62,6 +62,9 @@ energy to maintain their temperature (think sweating or burning calories to warm up). +Being near water helps creatures regulate their temperature a bit. They might +evolve to take advantage of this. + Creatures have an insulation rating that affects how fast or slow they exchange heat to/from the environment (think different amounts of fur or skin). diff -r 4dccbc0c808a -r 57ce46be0449 src/silt/core.clj --- a/src/silt/core.clj Mon Dec 14 16:13:27 2015 +0000 +++ b/src/silt/core.clj Mon Dec 14 16:31:16 2015 +0000 @@ -207,9 +207,19 @@ dest))) +(defn near-water [animal] + (->> animal + :loc + neighbors + (map @terrain) + (filter identity) + (filter #(= (:name %) :water)) + empty?)) + (defn affect-temp [animal] (assoc animal :temp (float (/ (Math/abs @world-temp) - (inc (Math/abs (:insulation animal))))))) + (inc (Math/abs (:insulation animal))) + (if (near-water animal) 5 1))))) (defn fix-temp [{:keys [temp] :as animal}] (-> animal @@ -312,7 +322,7 @@ y (rr/rand-gaussian-int oy pond-size)]] {:name :water :glyph "≈" - :energy 0.01 + :energy 0.1 :loc (normalize-world-coords [x y]) :styles {:fg :black :bg :blue}}))