Prepended all namespaces with 'cc.journeyman'; tests run, 4 don't pass.
This commit is contained in:
parent
37dbb767ac
commit
310896cc95
1
.calva/output-window/.clj-kondo/config.edn
Normal file
1
.calva/output-window/.clj-kondo/config.edn
Normal file
|
@ -0,0 +1 @@
|
|||
^:replace {:linters {}}
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -19,3 +19,5 @@ pom.xml.asc
|
|||
.cpcache/
|
||||
*~
|
||||
|
||||
|
||||
.calva/output-window/output.calva-repl
|
||||
|
|
|
@ -6,4 +6,4 @@ First and foremost, it's slow, and both processor and memory hungry. That means
|
|||
|
||||
Of course it would be possible to do a run at one km scale top identify areas which would support settlement, and then to do a run on a ten metre grid on each of those areas to more precisely plot settlement. That's an idea which I haven't yet explored, which might prove fruitful.
|
||||
|
||||
Secondly, being a cellular automaton, MicroWorld works on a grid. This means that everything is grid aligned, which is absolutely not what I want! So I think the way to leverage this is to use Microworld to establish which kilometre square cells om the grid should be populated (and roughly with what), and then switch to ad hoc code to populate those cells.
|
||||
Secondly, being a cellular automaton, MicroWorld works on a grid. This means that everything is grid aligned, which is absolutely not what I want! So I think the way to leverage this is to use MicroWorld to establish which kilometre square cells om the grid should be populated (and roughly with what), and then switch to *ad hoc* code to populate those cells.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.agent.agent
|
||||
(ns cc.journeyman.the-great-game.agent.agent
|
||||
"Anything in the game world with agency"
|
||||
(:require [the-great-game.objects.game-object :refer [ProtoObject]]
|
||||
[the-great-game.objects.container :refer [ProtoContainer]]))
|
||||
|
@ -35,9 +35,10 @@
|
|||
"Returns a sequence of effects an actor intends, as a consequence of
|
||||
acting. The encoding of these is not yet defined."))
|
||||
|
||||
;; (defrecord Agent
|
||||
;; "A default agent."
|
||||
;; ProtoObject
|
||||
;; ProtoContainer
|
||||
;; ProtoAgent
|
||||
;; )
|
||||
(defrecord Agent
|
||||
;; "A default agent."
|
||||
[name home tribe]
|
||||
ProtoObject
|
||||
ProtoContainer
|
||||
ProtoAgent
|
||||
)
|
|
@ -1,7 +1,7 @@
|
|||
(ns the-great-game.gossip.gossip
|
||||
(ns cc.journeyman.the-great-game.gossip.gossip
|
||||
"Interchange of news events between gossip agents"
|
||||
(:require [the-great-game.utils :refer [deep-merge]]
|
||||
[the-great-game.gossip.news-items :refer [learn-news-item]]))
|
||||
(:require [cc.journeyman.the-great-game.utils :refer [deep-merge]]
|
||||
[cc.journeyman.the-great-game.gossip.news-items :refer [learn-news-item]]))
|
||||
|
||||
;; Note that habitual travellers are all gossip agents; specifically, at this
|
||||
;; stage, that means merchants. When merchants are moved we also need to
|
|
@ -1,7 +1,7 @@
|
|||
(ns the-great-game.gossip.news-items
|
||||
(ns cc.journeyman.the-great-game.gossip.news-items
|
||||
"Categories of news events interesting to gossip agents"
|
||||
(:require [the-great-game.world.location :refer [distance-between]]
|
||||
[the-great-game.time :refer [game-time]]))
|
||||
(:require [cc.journeyman.the-great-game.world.location :refer [distance-between]]
|
||||
[cc.journeyman.the-great-game.time :refer [game-time]]))
|
||||
|
||||
;; The ideas here are based on the essay 'The spread of knowledge in a large
|
||||
;; game world', q.v.; they've advanced a little beyond that and will doubtless
|
|
@ -1,7 +1,7 @@
|
|||
(ns the-great-game.merchants.markets
|
||||
(ns cc.journeyman.the-great-game.merchants.markets
|
||||
"Adjusting quantities and prices in markets."
|
||||
(:require [taoensso.timbre :as l :refer [info error]]
|
||||
[the-great-game.utils :refer [deep-merge]]))
|
||||
[cc.journeyman.the-great-game.utils :refer [deep-merge]]))
|
||||
|
||||
(defn new-price
|
||||
"If `stock` is greater than the maximum of `supply` and `demand`, then
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.merchants.merchant-utils
|
||||
(ns cc.journeyman.the-great-game.merchants.merchant-utils
|
||||
"Useful functions for doing low-level things with merchants.")
|
||||
|
||||
(defn expected-price
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.merchants.merchants
|
||||
(ns cc.journeyman.the-great-game.merchants.merchants
|
||||
"Trade planning for merchants, primarily."
|
||||
(:require [taoensso.timbre :as l :refer [info error spy]]
|
||||
[the-great-game.utils :refer [deep-merge]]
|
|
@ -1,12 +1,12 @@
|
|||
(ns the-great-game.merchants.planning
|
||||
(ns cc.journeyman.the-great-game.merchants.planning
|
||||
"Trade planning for merchants, primarily. This follows a simple-minded
|
||||
generate-and-test strategy and currently generates plans for all possible
|
||||
routes from the current location. This may not scale. Also, routes do not
|
||||
currently have cost or risk associated with them."
|
||||
(:require [the-great-game.utils :refer [deep-merge make-target-filter]]
|
||||
[the-great-game.merchants.merchant-utils :refer :all]
|
||||
[the-great-game.world.routes :refer [find-route]]
|
||||
[the-great-game.world.world :refer [actual-price default-world]]))
|
||||
(:require [cc.journeyman.the-great-game.utils :refer [deep-merge make-target-filter]]
|
||||
[cc.journeyman.the-great-game.merchants.merchant-utils :refer [can-afford can-carry expected-price]]
|
||||
[cc.journeyman.the-great-game.world.routes :refer [find-route]]
|
||||
[cc.journeyman.the-great-game.world.world :refer [actual-price default-world]]))
|
||||
|
||||
(defn generate-trade-plans
|
||||
"Generate all possible trade plans for this `merchant` and this `commodity`
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.merchants.strategies.simple
|
||||
(ns cc.journeyman.the-great-game.merchants.strategies.simple
|
||||
"Default trading strategy for merchants.
|
||||
|
||||
The simple strategy buys a single product in the local market if there is
|
||||
|
@ -7,12 +7,12 @@
|
|||
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]]
|
||||
[the-great-game.utils :refer [deep-merge]]
|
||||
[the-great-game.gossip.gossip :refer [move-gossip]]
|
||||
[the-great-game.merchants.planning :refer :all]
|
||||
[the-great-game.merchants.merchant-utils :refer
|
||||
[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]]
|
||||
[cc.journeyman.the-great-game.merchants.merchant-utils :refer
|
||||
[add-stock add-known-prices]]
|
||||
[the-great-game.world.routes :refer [find-route]]))
|
||||
[cc.journeyman.the-great-game.world.routes :refer [find-route]]))
|
||||
|
||||
(defn plan-and-buy
|
||||
"Return a world like this `world`, in which this `merchant` has planned
|
|
@ -1,6 +1,6 @@
|
|||
(ns the-great-game.objects.container
|
||||
(ns cc.journeyman.the-great-game.objects.container
|
||||
(:require
|
||||
[the-great-game.objects.game-object :refer :all]))
|
||||
[cc.journeyman.the-great-game.objects.game-object :refer :all]))
|
||||
|
||||
(defprotocol ProtoContainer
|
||||
(contents
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.objects.game-object
|
||||
(ns cc.journeyman.the-great-game.objects.game-object
|
||||
"Anything at all in the game world")
|
||||
|
||||
(defprotocol ProtoObject
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.time
|
||||
(ns cc.journeyman.the-great-game.time
|
||||
(:require [clojure.string :as s]))
|
||||
|
||||
(def game-start-time
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.utils)
|
||||
(ns cc.journeyman.the-great-game.utils)
|
||||
|
||||
(defn cyclic?
|
||||
"True if two or more elements of `route` are identical"
|
|
@ -1,10 +1,10 @@
|
|||
(ns the-great-game.world.heightmap
|
||||
(ns cc.journeyman.the-great-game.world.heightmap
|
||||
"Functions dealing with the tessellated multi-layer heightmap."
|
||||
(:require [clojure.math.numeric-tower :refer [expt sqrt]]
|
||||
[mw-engine.core :refer []]
|
||||
[mw-engine.heightmap :refer [apply-heightmap]]
|
||||
[mw-engine.utils :refer [get-cell in-bounds? map-world]]
|
||||
[the-great-game.utils :refer [value-or-default]]))
|
||||
[mw-engine.utils :refer [get-cell in-bounds? map-world scale-world]]
|
||||
[cc.journeyman.the-great-game.utils :refer [value-or-default]]))
|
||||
|
||||
;; It's not at all clear to me yet what the workflow for getting a MicroWorld
|
||||
;; map into The Great Game, and whether it passes through Walkmap to get here.
|
||||
|
@ -129,7 +129,8 @@
|
|||
(>= (:x cell) x-offset)
|
||||
(< (:x cell) (+ x-offset width)))
|
||||
cell))
|
||||
row)))))))))
|
||||
row)))))
|
||||
grid))))
|
||||
|
||||
(defn get-surface
|
||||
"Return, as a vector of vectors of cells represented as Clojure maps, a
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.world.location
|
||||
(ns cc.journeyman.the-great-game.world.location
|
||||
"Functions dealing with location in the world."
|
||||
(:require [clojure.math.numeric-tower :refer [expt sqrt]]))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.world.mw
|
||||
(ns cc.journeyman.the-great-game.world.mw
|
||||
"Functions dealing with building a great game world from a MicroWorld world."
|
||||
(:require [clojure.math.numeric-tower :refer [expt sqrt]]
|
||||
[mw-engine.core :refer []]
|
|
@ -1,6 +1,6 @@
|
|||
(ns the-great-game.world.routes
|
||||
(ns cc.journeyman.the-great-game.world.routes
|
||||
"Conceptual (plan level) routes, represented as tuples of location ids."
|
||||
(:require [the-great-game.utils :refer [cyclic?]]))
|
||||
(:require [cc.journeyman.the-great-game.utils :refer [cyclic?]]))
|
||||
|
||||
(defn find-routes
|
||||
"Find routes from among these `routes` from `from`; if `to` is supplied,
|
|
@ -1,12 +1,12 @@
|
|||
(ns the-great-game.world.run
|
||||
(ns cc.journeyman.the-great-game.world.run
|
||||
"Run the whole simulation"
|
||||
(:require [environ.core :refer [env]]
|
||||
[taoensso.timbre :as timbre]
|
||||
[taoensso.timbre.appenders.3rd-party.rotor :as rotor]
|
||||
[the-great-game.gossip.gossip :as g]
|
||||
[the-great-game.merchants.merchants :as m]
|
||||
[the-great-game.merchants.markets :as k]
|
||||
[the-great-game.world.world :as w]))
|
||||
[cc.journeyman.the-great-game.gossip.gossip :as g]
|
||||
[cc.journeyman.the-great-game.merchants.merchants :as m]
|
||||
[cc.journeyman.the-great-game.merchants.markets :as k]
|
||||
[cc.journeyman.the-great-game.world.world :as w]))
|
||||
|
||||
(defn init
|
||||
([]
|
|
@ -1,4 +1,4 @@
|
|||
(ns the-great-game.world.world
|
||||
(ns cc.journeyman.the-great-game.world.world
|
||||
"Access to data about the world")
|
||||
|
||||
;;; The world has to work either as map or a database. Initially, and for
|
4
test/cc/journeyman/the_great_game/gossip/gossip_test.clj
Normal file
4
test/cc/journeyman/the_great_game/gossip/gossip_test.clj
Normal file
|
@ -0,0 +1,4 @@
|
|||
(ns cc.journeyman.the-great-game.gossip.gossip-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[cc.journeyman.the-great-game.gossip.gossip :refer :all]))
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
(ns the-great-game.gossip.news-items-test
|
||||
(ns cc.journeyman.the-great-game.gossip.news-items-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.gossip.news-items :refer :all]))
|
||||
|
||||
[cc.journeyman.the-great-game.gossip.news-items :refer
|
||||
[degrade-location infer interest-in-location interesting-location?
|
||||
learn-news-item make-all-inferences]]))
|
||||
|
||||
(deftest location-test
|
||||
(testing "Interest in locations"
|
|
@ -1,8 +1,8 @@
|
|||
(ns the-great-game.merchants.markets-test
|
||||
(ns cc.journeyman.the-great-game.merchants.markets-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.utils :refer [deep-merge]]
|
||||
[the-great-game.world.world :refer [default-world]]
|
||||
[the-great-game.merchants.markets :refer :all]))
|
||||
[cc.journeyman.the-great-game.utils :refer [deep-merge]]
|
||||
[cc.journeyman.the-great-game.world.world :refer [default-world]]
|
||||
[cc.journeyman.the-great-game.merchants.markets :refer [adjust-quantity-and-price new-price run]]))
|
||||
|
||||
|
||||
(deftest new-price-test
|
||||
|
@ -23,7 +23,7 @@
|
|||
"The greater the relative oversupply, the more prices should fall")
|
||||
))
|
||||
|
||||
(deftest adjust-qunatity-and-price-test
|
||||
(deftest adjust-quantity-and-price-test
|
||||
(testing "Adjustment in quantity and price: supply only."
|
||||
(let [world (deep-merge
|
||||
default-world
|
|
@ -1,8 +1,9 @@
|
|||
(ns the-great-game.merchants.merchant-utils-test
|
||||
(ns cc.journeyman.the-great-game.merchants.merchant-utils-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.utils :refer [deep-merge]]
|
||||
[the-great-game.world.world :refer [default-world]]
|
||||
[the-great-game.merchants.merchant-utils :refer :all]))
|
||||
[cc.journeyman.the-great-game.utils :refer [deep-merge]]
|
||||
[cc.journeyman.the-great-game.world.world :refer [default-world]]
|
||||
[cc.journeyman.the-great-game.merchants.merchant-utils :refer
|
||||
[add-stock burden can-afford can-carry expected-price]]))
|
||||
|
||||
(deftest expected-price-test
|
||||
(testing "Anticipated prices in markets"
|
|
@ -1,8 +1,8 @@
|
|||
(ns the-great-game.merchants.planning-test
|
||||
(ns cc.journeyman.the-great-game.merchants.planning-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.utils :refer [deep-merge]]
|
||||
[the-great-game.world.world :refer [default-world]]
|
||||
[the-great-game.merchants.planning :refer :all]))
|
||||
[cc.journeyman.the-great-game.utils :refer [deep-merge]]
|
||||
[cc.journeyman.the-great-game.world.world :refer [default-world]]
|
||||
[cc.journeyman.the-great-game.merchants.planning :refer [plan-trade select-cargo]]))
|
||||
|
||||
|
||||
(deftest plan-trade-test
|
|
@ -1,7 +1,9 @@
|
|||
(ns the-great-game.time-test
|
||||
(ns cc.journeyman.the-great-game.time-test
|
||||
(:require [clojure.test :refer :all]
|
||||
;; [clojure.core.async :refer [thread <!]]
|
||||
[the-great-game.time :refer :all]))
|
||||
[cc.journeyman.the-great-game.time :refer
|
||||
[date-string day days-in-season days-in-week game-day-length
|
||||
game-time game-start-time now season week]]))
|
||||
|
||||
(deftest now-tests
|
||||
(testing "Time progresses"
|
|
@ -1,6 +1,6 @@
|
|||
(ns the-great-game.utils-test
|
||||
(ns cc.journeyman.the-great-game.utils-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.utils :refer :all]))
|
||||
[cc.journeyman.the-great-game.utils :refer [cyclic?]]))
|
||||
|
||||
(deftest cyclic-tests
|
||||
(testing "Detecting cyclic routes"
|
|
@ -1,6 +1,6 @@
|
|||
(ns the-great-game.world.location-test
|
||||
(ns cc.journeyman.the-great-game.world.location-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.world.location :refer :all]))
|
||||
[cc.journeyman.the-great-game.world.location :refer :all]))
|
||||
|
||||
(deftest get-coords-test
|
||||
(testing "Get coordinates of location"
|
|
@ -1,7 +1,7 @@
|
|||
(ns the-great-game.world.routes-test
|
||||
(ns cc.journeyman.the-great-game.world.routes-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.world.routes :refer :all]
|
||||
[the-great-game.world.world :refer [default-world]]))
|
||||
[cc.journeyman.the-great-game.world.routes :refer :all]
|
||||
[cc.journeyman.the-great-game.world.world :refer [default-world]]))
|
||||
|
||||
|
||||
(deftest routing-test
|
4
test/cc/journeyman/the_great_game/world/world_test.clj
Normal file
4
test/cc/journeyman/the_great_game/world/world_test.clj
Normal file
|
@ -0,0 +1,4 @@
|
|||
(ns cc.journeyman.the-great-game.world.world-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[cc.journeyman.the-great-game.world.world :refer :all]))
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
(ns the-great-game.gossip.gossip-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.gossip.gossip :refer :all]))
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
(ns the-great-game.world.world-test
|
||||
(:require [clojure.test :refer :all]
|
||||
[the-great-game.world.world :refer :all]))
|
||||
|
17
workspace.code-workspace
Normal file
17
workspace.code-workspace
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"path": "../gossip"
|
||||
},
|
||||
{
|
||||
"path": "../walkmap"
|
||||
},
|
||||
{
|
||||
"path": "../genbuildings"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
Loading…
Reference in a new issue