83ce53f6aac0
Temperature
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Sun, 13 Dec 2015 19:58:54 +0000 |
parents | 282dc14e97d4 |
children | 3ab84c833b9c |
branches/tags | (none) |
files | src/silt/core.clj |
Changes
--- a/src/silt/core.clj Sun Dec 13 19:44:51 2015 +0000 +++ b/src/silt/core.clj Sun Dec 13 19:58:54 2015 +0000 @@ -160,8 +160,15 @@ dest))) -(defn affect-temp [animal] animal) -(defn fix-temp [animal] animal) +(defn affect-temp [animal] + (assoc animal :temp (float (/ (Math/abs @world-temp) + (inc (Math/abs (:insulation animal))))))) + +(defn fix-temp [{:keys [temp] :as animal}] + (-> animal + (assoc :temp 0) + (update-in [:energy] - (Math/abs temp)))) + (defn find-resources [{:keys [loc] :as animal}] (let [found (->> loc neighbors