cc.journeyman.the-great-game.merchants.merchant-utils
Useful functions for doing low-level things with merchants.
add-known-prices
(add-known-prices merchant world)
Add the current prices at this merchant
’s location in the world
to a new cache of known prices, and return it.
add-stock
(add-stock a b)
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.
burden
(burden merchant world)
The total weight of the current cargo carried by this merchant
in this world
.
can-afford
(can-afford merchant world commodity)
Return the number of units of this commodity
which this merchant
can afford to buy in this world
.
can-carry
(can-carry merchant world commodity)
Return the number of units of this commodity
which this merchant
can carry in this world
, given their current burden.
expected-price
(expected-price merchant commodity city)
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.