## Generated by Codox

# The-great-game 0.1.1

# 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 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.

view source

### plan-and-buy

`(plan-and-buy merchant world)`

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.

view source

### re-plan

`(re-plan merchant world)`

Having failed to sell a cargo at current location, re-plan a route to sell the current cargo. Returns a revised world.

view source

### sell-and-buy

`(sell-and-buy merchant world)`

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.

view source