Still mostly working on documentation.

This commit is contained in:
Simon Brooke 2024-05-02 14:16:37 +01:00
parent daa8e571f3
commit fd4a5bb8cc
80 changed files with 484 additions and 177 deletions

View file

@ -34,7 +34,7 @@
[cc.journeyman.the-great-game.world.location :refer [distance-between]]
[cc.journeyman.the-great-game.time :refer [game-time]]
[cc.journeyman.the-great-game.utils :refer [inc-or-one truthy?]]
[taoensso.timbre :as l]))
[taoensso.telemere.timbre :as l]))
(declare interesting-location?)

View file

@ -1,6 +1,6 @@
(ns cc.journeyman.the-great-game.merchants.markets
"Adjusting quantities and prices in markets."
(:require [taoensso.timbre :as l :refer [info error]]
(:require [taoensso.telemere.timbre :as l :refer [info error]]
[cc.journeyman.the-great-game.utils :refer [deep-merge]]))
(defn new-price

View file

@ -2,7 +2,7 @@
"Trade planning for merchants, primarily."
(:require [cc.journeyman.the-great-game.utils :refer [deep-merge]]
[cc.journeyman.the-great-game.merchants.strategies.simple :refer [move-merchant]]
[taoensso.timbre :as l]))
[taoensso.telemere.timbre :as l]))
(defn run

View file

@ -6,7 +6,7 @@
and sells it there. If there is no commodity locally which can be traded
profitably, moves towards home with no cargo. If at home and no commodity
can be traded profitably, does not move."
(:require [taoensso.timbre :as l :refer [info error spy]]
(:require [taoensso.telemere.timbre :as l :refer [info error spy]]
[cc.journeyman.the-great-game.utils :refer [deep-merge]]
[cc.journeyman.the-great-game.gossip.gossip :refer [move-gossip]]
[cc.journeyman.the-great-game.merchants.planning :refer [augment-plan plan-trade select-cargo]]
@ -72,7 +72,6 @@
(map? merchant)
merchant)
id (:id m)
location (:location m)
plan (augment-plan m world (plan-trade m world (-> m :plan :commodity)))]
(l/debug "re-plan: merchant" id)
(deep-merge

View file

@ -6,7 +6,7 @@
[mw-engine.heightmap :refer [apply-heightmap]]
[mw-engine.utils :refer [map-world]]
[mw-parser.declarative :refer [compile]]
[taoensso.timbre :refer [info]]
[taoensso.telemere.timbre :refer [info]]
[wherefore-art-thou.core :refer [*genders* generate]]))
(defn get-drainage-map
@ -45,17 +45,19 @@
;; persist them in the database being built. This is just a sketch.
[prototype]
(let [g (or (:gender prototype) (rand-nth (keys *genders*)))
p (generate g)]
(dissoc (merge {:age (+ 18 (rand-int 18))
:disposition (- (rand-int 9) 4) ;; -4: surly to +4 sunny
:gender g
:goal (rand-nth *life-goals*)
:family-name (generate)
:occupation :vagrant
:personal-name p} prototype)
;; it's useful to have the world available to the create function,
;; but we don't want to return it in the results because clutter.
:world)))
p (generate g)
npc (dissoc (merge {:age (+ 18 (rand-int 18))
:disposition (- (rand-int 9) 4) ;; -4: surly to +4 sunny
:gender g
:goal (rand-nth *life-goals*)
:family-name (generate)
:occupation :vagrant
:personal-name p} prototype)
;; it's useful to have the world available to the create function,
;; but we don't want to return it in the results because clutter.
:world)]
(info (format "Created NPC %s" (select-keys npc [:id :family-name :personal-name :age :gender :occupation :goal])))
))
(defn- populate-npcs
[prototype]
@ -65,7 +67,7 @@
(defn populate-cell
[world cell]
;; (info (format "populate-cell: w is %s; cell is %s" (type world) cell))
(info (format "populate-cell: w is %s; cell is %s" (type world) cell))
(let [npcs (case (:state cell)
:camp (populate-npcs {:world world :cell cell :occupation :nomad})
:house (populate-npcs {:world world :cell cell :occupation :peasant})

View file

@ -1,7 +1,7 @@
(ns cc.journeyman.the-great-game.world.run
"Run the whole simulation"
(:require [environ.core :refer [env]]
[taoensso.timbre :as timbre]
[taoensso.telemere.timbre :as timbre]
[taoensso.timbre.appenders.3rd-party.rotor :as rotor]
[cc.journeyman.the-great-game.gossip.gossip :as g]
[cc.journeyman.the-great-game.merchants.merchants :as m]