the-great-game.merchants.merchants
Trade planning for merchants, primarily.
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.
Returns the augmented plan.
burden
(burden merchant world)
The total weight of the current cargo carried by this merchant
in this world
.
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.
find-trade-plan
(find-trade-plan merchant world commodity)
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 thatcommodity
can be sold; - :distance - the number of stages in the planned journey
- :dist-to-home - the distance from
destination
to themerchant
’s home city.
select-cargo
(select-cargo merchant world)
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.