diff --git a/doc/Population.ods b/doc/Population.ods
new file mode 100644
index 0000000..494ac80
Binary files /dev/null and b/doc/Population.ods differ
diff --git a/doc/economy.md b/doc/economy.md
new file mode 100644
index 0000000..45ed00a
--- /dev/null
+++ b/doc/economy.md
@@ -0,0 +1,49 @@
+# Game world economy
+
+Broadly this essay extends ideas presented in [Populating a game world](https://blog.journeyman.cc/2013/07/populating-game-world.html), q.v.
+
+## Primary producers
+
+### Herdsfolk
+
+Herdsfolk are nomadic; it's reasonable to think they'll bring their herds to market, rather than selling it lots of tiny markets. So in the spring, shepherds will visit specific towns at the edge of open land, to hold a shearing festival/carnevale; and that both shepherds and cattle herders will visit towns on the edge of open land to sell fatstock in the autumn.
+
+### Miners
+
+Miners mine. They're settled, but they're settled usually in specialist settlements at the location where the ore body is accessible, usually in mountenous territory. They'll consume a lot of food, so there will be a local market for foodstuffs encouraging local farming. Different mines obviously mine different ores, but, for example, lead and silver are frequently found together.
+
+### Foresters
+
+Foresters are more or less settled at the edge of forests, at locations from which timber can be moved by navigable water; again in specialist settlements. In addition to timber, foresters hunt and produce both meat and furs, so have less need for other food producers locally.
+
+### Farmers
+
+Farmers are settled. Farmers occupy standard runrig plots, but because they don't employ journeymen or apprentices, and don't have workshops, the plots are mostly open with little building. Most farmers are 'mixed farmers', producing cereals, meat, eggs and milk. Some will be more specialist. Farm produce, taken broadly to include orchardsfolk, include:
+
+* meat
+* milk and milk products
+* hides
+* eggs
+* cereals
+* root vegetables, onions, etc
+* peas and beans
+* leaf vegetables
+* fruits
+* fibres: linen, hemp and silk (from silk-moths in mulberry orchards)
+* possibly other stuff I've forgotten.
+
+Farmers are all basically subsistence farmers, farming first to feed their own household and selling only surplus in the market.
+
+## Crafts
+
+Crafts generally process primary goods into secondary goods - whether intermediate stages or final consumer items. Some elite 'crafts' deal with abstract primary goods like law and knowledge, and they may be seen as somewhat separate.
+
+A master craftsperson occupies a standard runrig plot, much like a farmer's plot. Like a farmer, a poor master crafter household will cultivate part of the plot to produce food for the house - at least grow vegetables and keep hens. However, as the crafter takes on apprentices and journeymen - and gets richer - more buildings will be required as accommodation, workshop space and materials stores.
+
+Generally, primary goods aren't transported over land - because overland transport is expensive, by the time they've been transported they're no longer low cost goods. So often the craftspeople who process primary produce into at least commodity intermediate forms will live close to the source of the primary goods.
+
+So, for example, the town(s) where the shepherds hold their shearing fairs will tend to have a lot of weavers. While around mines there will be smelters producing ingots and bar stock to be marketed to smiths all over the place, there will also be smiths close to the mines producing commodity tools and weapons.
+
+See the table in Populating a game world.
+
+
diff --git a/doc/modelling_trading_cost_and_risk.md b/doc/modelling_trading_cost_and_risk.md
new file mode 100644
index 0000000..3574d5b
--- /dev/null
+++ b/doc/modelling_trading_cost_and_risk.md
@@ -0,0 +1,9 @@
+# Modelling trading cost and risk
+
+In a dynamic pre-firearms world with many small states and contested regions, trade is not going to be straightforward. Not only will different routes have different physical characteristics - more or less mountainous, more or fewer unbridged river crossings - they will also have different political characteristics: more of less taxed, more or less effectively policed.
+
+Raids by outlaws are expected to be part of the game economy. News of raids are the sort of things which may propagate through the [[gossip]] system. So are changes in taxation regime. Obviously, knowledge items can affect merchants' trading strategy; in existing prototype code, individual merchants already each keep their own cache of known historical prices, and exchange historical price data with one another; and use this price data to select trades to make.
+
+So: to what extent is it worth modelling the spread of knowledge of trade cost and risk?
+
+Obviously the more we model, the more compute power modelling consumes. If the core objective is a Role Playing Games as currently understood, then there is no need to model very complex trade risk assessment behaviour.
diff --git a/doc/sexual-dimorphism.md b/doc/sexual-dimorphism.md
new file mode 100644
index 0000000..5325f5c
--- /dev/null
+++ b/doc/sexual-dimorphism.md
@@ -0,0 +1,45 @@
+# Sexual dimorphism
+
+This essay is going to upset a lot of people, so let's start with a statement of what it is about: it is an attempt to describe the systematically different behaviours of men and women, in sufficient detail that this can be represented by agents in a game world. It's trying to allow as broad as possible a range of cultures to be represented, so when I'm talking about what I consider to be behaviours of particular cultures, I'll say that.
+
+Of course, I'm writing this from the view point of an old white male. It's not possible to write about these things from a totally neutral viewpoint, and every one of us will have prejudices.
+
+OK? Let's start.
+
+When a man and a woman have sex, there's a non-zero chance that the woman will get pregnant. There's a zero chance that the male will get pregnant.
+
+A woman can typically give birth to of the order of twelve children in the course of her life, and each childbirth involves a non-zero risk of death. If modelling the sort of bronze-age-to-late-medieval cultures I'm generally considering, there are no available reliable methods of contraception, although their may be, for example, known spermicidal or abortifacient spells or potions. If it's abortifacient, that's pretty unpleasant for the woman, too.
+
+Children, especially when young, are very vulnerable and need protection. Children with good protection are much more likely to survive to adulthood. Raising children involves a fair amount of work.
+
+For all sorts of reasons, some of which are clearly cultural but others of which are fundamental, it's much easier for men to walk away from responsibility for their children than it is for women. For example, considering a pre-modern world, women would always know for certain which children were theirs, and men would not.
+
+For a woman, consequently, the best breeding strategy is to have sex only with men who will be 'good fathers', where there are three essential parameters to "good fathers":
+
+1. Desirable genetic traits;
+2. Preparedness to stick around and share the work;
+3. Ability to provide and protect.
+
+The essential trade-off in the traditional western marriage is that the man gets to have sex, and the woman gets to have protection for her progeny.
+
+Another significant point is that women's ability to bear children ceases at a much younger age than men's ability to father them.
+
+## Why have sex at all?
+
+If a character has 'having children' - the **Ancestor** aspiration, in my typology - as their key aim, then they will want to have sex. But to have children in this sense is to have acknowledged children, so while a male character may be motivated to have multiple female partners, he will never the less have some degree of long term committment to them, and will want both to feel confident that the children are his and to be recognised by their father.
+
+From the point of view of seeking to become an Ancestor, there is little benefit to the woman in having multiple partners, except in very harsh environments. It will be easier to give one partner confidence that all your children are his, and while a man can increase his number of potential progeny by having multiple wives, mistresses or other classes of long-term female sexual partners, a woman cannot.
+
+## Why have children?
+
+In modern Scotland, I have met a lot of women with a strong drive to have children for the sake of having children, where the best explanation they could give is that it's instinctual; it may be so. But beyond that, in many cultures children provide their (acknowledged) parents with care and security in their old age, may tend their graves and perform belief-related services after they die, and carry on their name and their stories into the future.
+
+Not everyone wants to have children; in thinking about the driving aspirations of game characters, I view having children one of six potential key aspirations.
+
+## Why else have sex?
+
+Sex, done right, is an extremely pleasant pastime. Sex can also be used to create and maintain bonds of committment, to demonstrate social status, to defuse tense situations, and transactionally in many ways, both formal and informal.
+
+For women, sex with other women carries with it no risk of pregnancy, so can be enjoyed or used for any of these purposes in very much the same way as it can by men; in other words, particularly for women, homosexual sex can be more lighthearted and carefree than heterosexual sex. To what extend our notions of homosexuality and heterosexuality are cultural I simply don't know. But because no children will result, a woman can afford to be more promiscuous with other women than she can with men.
+
+## How does this impact on
diff --git a/docs/_config.yml b/docs/_config.yml
deleted file mode 100644
index c741881..0000000
--- a/docs/_config.yml
+++ /dev/null
@@ -1 +0,0 @@
-theme: jekyll-theme-slate
\ No newline at end of file
diff --git a/docs/cloverage/coverage.css b/docs/cloverage/coverage.css
new file mode 100644
index 0000000..2be4e57
--- /dev/null
+++ b/docs/cloverage/coverage.css
@@ -0,0 +1,40 @@
+.covered {
+ font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
+ background-color: #558B55;
+}
+
+.not-covered {
+ font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
+ background-color: red;
+}
+
+.partial {
+ font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
+ background-color: orange;
+}
+
+.not-tracked {
+ font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
+}
+
+.blank {
+ font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
+}
+
+td {
+ padding-right: 10px;
+}
+
+td.with-bar {
+ width: 250px;
+ text-align: center;
+}
+
+td.with-number {
+ text-align: right;
+}
+
+td.ns-name {
+ min-width: 150px;
+ padding-right: 25px;
+}
diff --git a/docs/cloverage/index.html b/docs/cloverage/index.html
new file mode 100644
index 0000000..eba4573
--- /dev/null
+++ b/docs/cloverage/index.html
@@ -0,0 +1,192 @@
+
+
Herdsfolk are nomadic; it’s reasonable to think they’ll bring their herds to market, rather than selling it lots of tiny markets. So in the spring, shepherds will visit specific towns at the edge of open land, to hold a shearing festival/carnevale; and that both shepherds and cattle herders will visit towns on the edge of open land to sell fatstock in the autumn.
+
Miners
+
Miners mine. They’re settled, but they’re settled usually in specialist settlements at the location where the ore body is accessible, usually in mountenous territory. They’ll consume a lot of food, so there will be a local market for foodstuffs encouraging local farming. Different mines obviously mine different ores, but, for example, lead and silver are frequently found together.
+
Foresters
+
Foresters are more or less settled at the edge of forests, at locations from which timber can be moved by navigable water; again in specialist settlements. In addition to timber, foresters hunt and produce both meat and furs, so have less need for other food producers locally.
+
Farmers
+
Farmers are settled. Farmers occupy standard runrig plots, but because they don’t employ journeymen or apprentices, and don’t have workshops, the plots are mostly open with little building. Most farmers are ‘mixed farmers’, producing cereals, meat, eggs and milk. Some will be more specialist. Farm produce, taken broadly to include orchardsfolk, include:
+
+
meat
+
milk and milk products
+
hides
+
eggs
+
cereals
+
root vegetables, onions, etc
+
peas and beans
+
leaf vegetables
+
fruits
+
fibres: linen, hemp and silk (from silk-moths in mulberry orchards)
+
possibly other stuff I’ve forgotten.
+
+
Farmers are all basically subsistence farmers, farming first to feed their own household and selling only surplus in the market.
+
Crafts
+
Crafts generally process primary goods into secondary goods - whether intermediate stages or final consumer items. Some elite ‘crafts’ deal with abstract primary goods like law and knowledge, and they may be seen as somewhat separate.
+
A master craftsperson occupies a standard runrig plot, much like a farmer’s plot. Like a farmer, a poor master crafter household will cultivate part of the plot to produce food for the house - at least grow vegetables and keep hens. However, as the crafter takes on apprentices and journeymen - and gets richer - more buildings will be required as accommodation, workshop space and materials stores.
+
Generally, primary goods aren’t transported over land - because overland transport is expensive, by the time they’ve been transported they’re no longer low cost goods. So often the craftspeople who process primary produce into at least commodity intermediate forms will live close to the source of the primary goods.
+
So, for example, the town(s) where the shepherds hold their shearing fairs will tend to have a lot of weavers. While around mines there will be smelters producing ingots and bar stock to be marketed to smiths all over the place, there will also be smiths close to the mines producing commodity tools and weapons.
+
See the table in Populating a game world.
\ No newline at end of file
diff --git a/docs/codox/index.html b/docs/codox/index.html
new file mode 100644
index 0000000..545a41e
--- /dev/null
+++ b/docs/codox/index.html
@@ -0,0 +1,3 @@
+
+The-great-game 0.1.0-SNAPSHOT
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.
\ No newline at end of file
diff --git a/docs/intro.html b/docs/codox/intro.html
similarity index 87%
rename from docs/intro.html
rename to docs/codox/intro.html
index 3822424..691703e 100644
--- a/docs/intro.html
+++ b/docs/codox/intro.html
@@ -1,6 +1,6 @@
-Introduction to the-great-game
In this essay I’m going to try to pull together a number of my architectural ideas about the Great Game which I know I’m never actually going to build - because it’s vastly too big for any one person to build - into one overall vision.
So, firstly, how does one characterise this game?
diff --git a/docs/js/highlight.min.js b/docs/codox/js/highlight.min.js
similarity index 100%
rename from docs/js/highlight.min.js
rename to docs/codox/js/highlight.min.js
diff --git a/docs/js/jquery.min.js b/docs/codox/js/jquery.min.js
similarity index 100%
rename from docs/js/jquery.min.js
rename to docs/codox/js/jquery.min.js
diff --git a/docs/js/page_effects.js b/docs/codox/js/page_effects.js
similarity index 100%
rename from docs/js/page_effects.js
rename to docs/codox/js/page_effects.js
diff --git a/docs/codox/modelling_trading_cost_and_risk.html b/docs/codox/modelling_trading_cost_and_risk.html
new file mode 100644
index 0000000..71c862f
--- /dev/null
+++ b/docs/codox/modelling_trading_cost_and_risk.html
@@ -0,0 +1,7 @@
+
+Modelling trading cost and risk
In a dynamic pre-firearms world with many small states and contested regions, trade is not going to be straightforward. Not only will different routes have different physical characteristics - more or less mountainous, more or fewer unbridged river crossings - they will also have different political characteristics: more of less taxed, more or less effectively policed.
+
Raids by outlaws are expected to be part of the game economy. News of raids are the sort of things which may propagate through the gossip system. So are changes in taxation regime. Obviously, knowledge items can affect merchants’ trading strategy; in existing prototype code, individual merchants already each keep their own cache of known historical prices, and exchange historical price data with one another; and use this price data to select trades to make.
+
So: to what extent is it worth modelling the spread of knowledge of trade cost and risk?
+
Obviously the more we model, the more compute power modelling consumes. If the core objective is a Role Playing Games as currently understood, then there is no need to model very complex trade risk assessment behaviour.
\ No newline at end of file
diff --git a/docs/codox/sexual-dimorphism.html b/docs/codox/sexual-dimorphism.html
new file mode 100644
index 0000000..54624d7
--- /dev/null
+++ b/docs/codox/sexual-dimorphism.html
@@ -0,0 +1,28 @@
+
+Sexual dimorphism
This essay is going to upset a lot of people, so let’s start with a statement of what it is about: it is an attempt to describe the systematically different behaviours of men and women, in sufficient detail that this can be represented by agents in a game world. It’s trying to allow as broad as possible a range of cultures to be represented, so when I’m talking about what I consider to be behaviours of particular cultures, I’ll say that.
+
Of course, I’m writing this from the view point of an old white male. It’s not possible to write about these things from a totally neutral viewpoint, and every one of us will have prejudices.
+
OK? Let’s start.
+
When a man and a woman have sex, there’s a non-zero chance that the woman will get pregnant. There’s a zero chance that the male will get pregnant.
+
A woman can typically give birth to of the order of twelve children in the course of her life, and each childbirth involves a non-zero risk of death. If modelling the sort of bronze-age-to-late-medieval cultures I’m generally considering, there are no available reliable methods of contraception, although their may be, for example, known spermicidal or abortifacient spells or potions. If it’s abortifacient, that’s pretty unpleasant for the woman, too.
+
Children, especially when young, are very vulnerable and need protection. Children with good protection are much more likely to survive to adulthood. Raising children involves a fair amount of work.
+
For all sorts of reasons, some of which are clearly cultural but others of which are fundamental, it’s much easier for men to walk away from responsibility for their children than it is for women. For example, considering a pre-modern world, women would always know for certain which children were theirs, and men would not.
+
For a woman, consequently, the best breeding strategy is to have sex only with men who will be ‘good fathers’, where there are three essential parameters to “good fathers”:
+
+
Desirable genetic traits;
+
Preparedness to stick around and share the work;
+
Ability to provide and protect.
+
+
The essential trade-off in the traditional western marriage is that the man gets to have sex, and the woman gets to have protection for her progeny.
+
Another significant point is that women’s ability to bear children ceases at a much younger age than men’s ability to father them.
+
Why have sex at all?
+
If a character has ‘having children’ - the Ancestor aspiration, in my typology - as their key aim, then they will want to have sex. But to have children in this sense is to have acknowledged children, so while a male character may be motivated to have multiple female partners, he will never the less have some degree of long term committment to them, and will want both to feel confident that the children are his and to be recognised by their father.
+
From the point of view of seeking to become an Ancestor, there is little benefit to the woman in having multiple partners, except in very harsh environments. It will be easier to give one partner confidence that all your children are his, and while a man can increase his number of potential progeny by having multiple wives, mistresses or other classes of long-term female sexual partners, a woman cannot.
+
Why have children?
+
In modern Scotland, I have met a lot of women with a strong drive to have children for the sake of having children, where the best explanation they could give is that it’s instinctual; it may be so. But beyond that, in many cultures children provide their (acknowledged) parents with care and security in their old age, may tend their graves and perform belief-related services after they die, and carry on their name and their stories into the future.
+
Not everyone wants to have children; in thinking about the driving aspirations of game characters, I view having children one of six potential key aspirations.
+
Why else have sex?
+
Sex, done right, is an extremely pleasant pastime. Sex can also be used to create and maintain bonds of committment, to demonstrate social status, to defuse tense situations, and transactionally in many ways, both formal and informal.
+
For women, sex with other women carries with it no risk of pregnancy, so can be enjoyed or used for any of these purposes in very much the same way as it can by men; in other words, particularly for women, homosexual sex can be more lighthearted and carefree than heterosexual sex. To what extend our notions of homosexuality and heterosexuality are cultural I simply don’t know. But because no children will result, a woman can afford to be more promiscuous with other women than she can with men.
+
How does this impact on
\ No newline at end of file
diff --git a/docs/codox/the-great-game.core.html b/docs/codox/the-great-game.core.html
new file mode 100644
index 0000000..72be981
--- /dev/null
+++ b/docs/codox/the-great-game.core.html
@@ -0,0 +1,3 @@
+
+the-great-game.core documentation
\ No newline at end of file
diff --git a/docs/codox/the-great-game.gossip.gossip.html b/docs/codox/the-great-game.gossip.gossip.html
new file mode 100644
index 0000000..46e5d39
--- /dev/null
+++ b/docs/codox/the-great-game.gossip.gossip.html
@@ -0,0 +1,3 @@
+
+the-great-game.gossip.gossip documentation
Dialogue between an enquirer and an agent in this world; returns a map identical to enquirer except that its :gossip collection may have additional entries.
Return a world like this world but with this gossip moved to this new-location. Many gossips are essentially shadow-records of agents of other types, and the movement if the gossip should be controlled by the run function of the type of the record they shadow. The #run function below does NOT call this function.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.merchants.markets.html b/docs/codox/the-great-game.merchants.markets.html
new file mode 100644
index 0000000..a991e82
--- /dev/null
+++ b/docs/codox/the-great-game.merchants.markets.html
@@ -0,0 +1,3 @@
+
+the-great-game.merchants.markets documentation
Adjust the quantity of this commodity currently in stock in this city of this world. Return a fragmentary world which can be deep-merged into this world.
If stock is greater than the maximum of supply and demand, then there is surplus and old price is too high, so shold be reduced. If lower, then it is too low and should be increased.
(update-markets world)(update-markets world city)(update-markets world city commodity)
Return a world like this world, with quantities and prices in markets updated to reflect supply and demand. If city or city and commodity are specified, return a fragmentary world with only the changes for that city (and commodity if specified) populated.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.merchants.merchant-utils.html b/docs/codox/the-great-game.merchants.merchant-utils.html
new file mode 100644
index 0000000..d7940c2
--- /dev/null
+++ b/docs/codox/the-great-game.merchants.merchant-utils.html
@@ -0,0 +1,3 @@
+
+the-great-game.merchants.merchant-utils documentation
Where a and b are both maps all of whose values are numbers, return a map whose keys are a union of the keys of a and b and whose values are the sums of their respective values.
Find the price anticipated, given this world, by this merchant for this commodity in this city. If no information, assume 1. merchant should be passed as a map, commodity and city should be passed as keywords.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.merchants.merchants.html b/docs/codox/the-great-game.merchants.merchants.html
new file mode 100644
index 0000000..f63ba36
--- /dev/null
+++ b/docs/codox/the-great-game.merchants.merchants.html
@@ -0,0 +1,3 @@
+
+the-great-game.merchants.merchants documentation
\ No newline at end of file
diff --git a/docs/codox/the-great-game.merchants.planning.html b/docs/codox/the-great-game.merchants.planning.html
new file mode 100644
index 0000000..9751a9b
--- /dev/null
+++ b/docs/codox/the-great-game.merchants.planning.html
@@ -0,0 +1,26 @@
+
+the-great-game.merchants.planning documentation
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.
augment-plan
(augment-plan merchant world plan)
Augment this plan constructed in this world for this merchant with the :quantity of goods which should be bought and the :expected-profit of the trade.
Return the distance to the nearest destination among those of these plans which match these targets. Plans are expected to be plans as returned by generate-trade-plans, q.v.; targets are expected to be as accepted by make-target-filter, q.v.
Find the best destination in this world for this commodity given this merchant and this origin. If two cities are anticipated to offer the same price, the nearer should be preferred; if two are equally distant, the ones nearer to the merchant’s home should be preferred. merchant may be passed as a map or a keyword; commodity should be passed as a keyword.
+
The returned plan is a map with keys:
+
+
:merchant - the id of the merchant for whom the plan was created;
+
:origin - the city from which the trade starts;
+
:destination - the city to which the trade is planned;
+
:commodity - the commodity to be carried;
+
:buy-price - the price at which that commodity can be bought;
+
:expected-price - the price at which the merchant anticipates that commodity can be sold;
+
:distance - the number of stages in the planned journey
+
:dist-to-home - the distance from destination to the merchant’s home city.
A merchant, in a given location in a world, will choose to buy a cargo within the limit they are capable of carrying, which they can anticipate selling for a profit at a destination.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.merchants.strategies.simple.html b/docs/codox/the-great-game.merchants.strategies.simple.html
new file mode 100644
index 0000000..8032a66
--- /dev/null
+++ b/docs/codox/the-great-game.merchants.strategies.simple.html
@@ -0,0 +1,4 @@
+
+the-great-game.merchants.strategies.simple documentation
The simple strategy buys a single product in the local market if there is one which can be traded profitably, trades it to the chosen target market, 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.
move-merchant
(move-merchant merchant world)
Handle general en route movement of this merchant in this world; return a (partial or full) world like this world but in which the merchant may have been moved ot updated.
Return a world like this world, in which this merchant has planned a new trade, and bought appropriate stock for it. If no profitable trade can be planned, the merchant is simply moved towards their home.
Return a new world like this world, in which this merchant has sold their current stock in their current location, and planned a new trade, and bought appropriate stock for it.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.utils.html b/docs/codox/the-great-game.utils.html
new file mode 100644
index 0000000..4242f1b
--- /dev/null
+++ b/docs/codox/the-great-game.utils.html
@@ -0,0 +1,3 @@
+
+the-great-game.utils documentation
\ No newline at end of file
diff --git a/docs/codox/the-great-game.world.routes.html b/docs/codox/the-great-game.world.routes.html
new file mode 100644
index 0000000..4cde466
--- /dev/null
+++ b/docs/codox/the-great-game.world.routes.html
@@ -0,0 +1,3 @@
+
+the-great-game.world.routes documentation
Conceptual (plan level) routes, represented as tuples of location ids.
find-route
(find-route world-or-routes from to)
Find a single route from from to to in this world-or-routes, which may be either a world as defined in the-great-game.world.world or else a sequence of tuples of keywords.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.world.run.html b/docs/codox/the-great-game.world.run.html
new file mode 100644
index 0000000..109956c
--- /dev/null
+++ b/docs/codox/the-great-game.world.run.html
@@ -0,0 +1,3 @@
+
+the-great-game.world.run documentation
The pipeline to run the simulation each game day. Returns a world like this world, with all the various active elements updated. The optional date argument, if supplied, is set as the :date of the returned world.
\ No newline at end of file
diff --git a/docs/codox/the-great-game.world.world.html b/docs/codox/the-great-game.world.world.html
new file mode 100644
index 0000000..0194ed5
--- /dev/null
+++ b/docs/codox/the-great-game.world.world.html
@@ -0,0 +1,3 @@
+
+the-great-game.world.world documentation
Find the actual current price of this commodity in this city given this world. NOTE that merchants can only know the actual prices in the city in which they are currently located.
Return a world like this world with only the :date to this date (or id date not supplied, the current value incremented by one). For running other aspects of the simulation, see the-great-game.world.run.
Dialogue between an enquirer and an agent in this world; returns a map identical to enquirer except that its :gossip collection may have additional entries.
Return a world like this world but with this gossip moved to this new-location. Many gossips are essentially shadow-records of agents of other types, and the movement if the gossip should be controlled by the run function of the type of the record they shadow. The #run function below does NOT call this function.
Adjust the quantity of this commodity currently in stock in this city of this world. Return a fragmentary world which can be deep-merged into this world.
If stock is greater than the maximum of supply and demand, then there is surplus and old price is too high, so shold be reduced. If lower, then it is too low and should be increased.
(update-markets world)(update-markets world city)(update-markets world city commodity)
Return a world like this world, with quantities and prices in markets updated to reflect supply and demand. If city or city and commodity are specified, return a fragmentary world with only the changes for that city (and commodity if specified) populated.
Where a and b are both maps all of whose values are numbers, return a map whose keys are a union of the keys of a and b and whose values are the sums of their respective values.
Find the price anticipated, given this world, by this merchant for this commodity in this city. If no information, assume 1. merchant should be passed as a map, commodity and city should be passed as keywords.
Augment this plan constructed in this world for this merchant with the :quantity of goods which should be bought and the :expected-profit of the trade.
Return the distance to the nearest destination among those of these plans which match these targets. Plans are expected to be plans as returned by generate-trade-plans, q.v.; targets are expected to be as accepted by make-target-filter, q.v.
Find the best destination in this world for this commodity given this merchant and this origin. If two cities are anticipated to offer the same price, the nearer should be preferred; if two are equally distant, the ones nearer to the merchant’s home should be preferred. merchant may be passed as a map or a keyword; commodity should be passed as a keyword.
-
The returned plan is a map with keys:
-
-
:merchant - the id of the merchant for whom the plan was created;
-
:origin - the city from which the trade starts;
-
:destination - the city to which the trade is planned;
-
:commodity - the commodity to be carried;
-
:buy-price - the price at which that commodity can be bought;
-
:expected-price - the price at which the merchant anticipates that commodity can be sold;
-
:distance - the number of stages in the planned journey
-
:dist-to-home - the distance from destination to the merchant’s home city.
A merchant, in a given location in a world, will choose to buy a cargo within the limit they are capable of carrying, which they can anticipate selling for a profit at a destination.
The simple strategy buys a single product in the local market if there is one which can be traded profitably, trades it to the chosen target market, 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.
move-merchant
(move-merchant merchant world)
Handle general en route movement of this merchant in this world; return a (partial or full) world like this world but in which the merchant may have been moved ot updated.
Return a world like this world, in which this merchant has planned a new trade, and bought appropriate stock for it. If no profitable trade can be planned, the merchant is simply moved towards their home.
Return a new world like this world, in which this merchant has sold their current stock in their current location, and planned a new trade, and bought appropriate stock for it.
Conceptual (plan level) routes, represented as tuples of location ids.
find-route
(find-route world-or-routes from to)
Find a single route from from to to in this world-or-routes, which may be either a world as defined in the-great-game.world.world or else a sequence of tuples of keywords.
The pipeline to run the simulation each game day. Returns a world like this world, with all the various active elements updated. The optional date argument, if supplied, is set as the :date of the returned world.
Find the actual current price of this commodity in this city given this world. NOTE that merchants can only know the actual prices in the city in which they are currently located.
Return a world like this world with only the :date to this date (or id date not supplied, the current value incremented by one). For running other aspects of the simulation, see the-great-game.world.run.