26 lines
17 KiB
HTML
26 lines
17 KiB
HTML
<!DOCTYPE html PUBLIC ""
|
||
"">
|
||
<html><head><meta charset="UTF-8" /><title>cc.journeyman.the-great-game.merchants.planning documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">The-great-game</span> <span class="project-version">0.1.2-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="Baking-the-world.html"><div class="inner"><span>Baking the world</span></div></a></li><li class="depth-1 "><a href="Canonical-dictionary.html"><div class="inner"><span>A Canonical dictionary for this documentation</span></div></a></li><li class="depth-1 "><a href="Dynamic-consequences.html"><div class="inner"><span>On the consequences of a dynamic game environment for storytelling</span></div></a></li><li class="depth-1 "><a href="Game_Play.html"><div class="inner"><span>Game Play</span></div></a></li><li class="depth-1 "><a href="Gossip_scripted_plot_and_Johnny_Silverhand.html"><div class="inner"><span>Gossip, scripted plot, and Johnny Silverhand</span></div></a></li><li class="depth-1 "><a href="Organic_Quests.html"><div class="inner"><span>Organic Quests</span></div></a></li><li class="depth-1 "><a href="Pathmaking.html"><div class="inner"><span>Pathmaking</span></div></a></li><li class="depth-1 "><a href="Populating-a-game-world.html"><div class="inner"><span>Populating a game world</span></div></a></li><li class="depth-1 "><a href="Roadmap.html"><div class="inner"><span>Roadmap</span></div></a></li><li class="depth-1 "><a href="Settling-a-game-world.html"><div class="inner"><span>Settling a game world</span></div></a></li><li class="depth-1 "><a href="Simulation-layers.html"><div class="inner"><span>Simulation layers</span></div></a></li><li class="depth-1 "><a href="The-spread-of-knowledge-in-a-large-game-world.html"><div class="inner"><span>The spread of knowledge in a large game world</span></div></a></li><li class="depth-1 "><a href="Uncanny_dialogue.html"><div class="inner"><span>The Uncanny Valley, and dynamically generated dialogue</span></div></a></li><li class="depth-1 "><a href="Voice-acting-considered-harmful.html"><div class="inner"><span>Voice acting considered harmful</span></div></a></li><li class="depth-1 "><a href="building_on_microworld.html"><div class="inner"><span>Building on Microworld</span></div></a></li><li class="depth-1 "><a href="economy.html"><div class="inner"><span>Game world economy</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to the-great-game</span></div></a></li><li class="depth-1 "><a href="modelling_trading_cost_and_risk.html"><div class="inner"><span>Modelling trading cost and risk</span></div></a></li><li class="depth-1 "><a href="naming-of-characters.html"><div class="inner"><span>Naming of Characters</span></div></a></li><li class="depth-1 "><a href="on-dying.html"><div class="inner"><span>On Dying</span></div></a></li><li class="depth-1 "><a href="sandbox.html"><div class="inner"><span>Sandbox</span></div></a></li><li class="depth-1 "><a href="sexual-dimorphism.html"><div class="inner"><span>Sexual dimorphism</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cc</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>journeyman</span></div></div></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>the-great-game</span></div></div></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>agent</span></div></div></li><li class="depth-5"><a href="cc.journeyman.the-great-game.agent.agent.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>agent</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>buildings</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.buildings.module.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>module</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.buildings.rectangular.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>rectangular</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>gossip</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.gossip.gossip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gossip</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.gossip.news-items.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>news-items</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>holdings</span></div></div></li><li class="depth-5"><a href="cc.journeyman.the-great-game.holdings.holding.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>holding</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>location</span></div></div></li><li class="depth-5"><a href="cc.journeyman.the-great-game.location.location.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>location</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>merchants</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.markets.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>markets</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.merchant-utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>merchant-utils</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.merchants.merchants.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>merchants</span></div></a></li><li class="depth-5 branch current"><a href="cc.journeyman.the-great-game.merchants.planning.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>planning</span></div></a></li><li class="depth-5"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>strategies</span></div></div></li><li class="depth-6"><a href="cc.journeyman.the-great-game.merchants.strategies.simple.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>simple</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>objects</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.objects.container.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>container</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.objects.game-object.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>game-object</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.playroom.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>playroom</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.time.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>time</span></div></a></li><li class="depth-4 branch"><a href="cc.journeyman.the-great-game.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>world</span></div></div></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.heightmap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>heightmap</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.location.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>location</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.mw.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mw</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.routes.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>routes</span></div></a></li><li class="depth-5 branch"><a href="cc.journeyman.the-great-game.world.run.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>run</span></div></a></li><li class="depth-5"><a href="cc.journeyman.the-great-game.world.world.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>world</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="cc.journeyman.the-great-game.merchants.planning.html#var-augment-plan"><div class="inner"><span>augment-plan</span></div></a></li><li class="depth-1"><a href="cc.journeyman.the-great-game.merchants.planning.html#var-generate-trade-plans"><div class="inner"><span>generate-trade-plans</span></div></a></li><li class="depth-1"><a href="cc.journeyman.the-great-game.merchants.planning.html#var-nearest-with-targets"><div class="inner"><span>nearest-with-targets</span></div></a></li><li class="depth-1"><a href="cc.journeyman.the-great-game.merchants.planning.html#var-plan-trade"><div class="inner"><span>plan-trade</span></div></a></li><li class="depth-1"><a href="cc.journeyman.the-great-game.merchants.planning.html#var-select-cargo"><div class="inner"><span>select-cargo</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">cc.journeyman.the-great-game.merchants.planning</h1><div class="doc"><div class="markdown"><p>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.</p></div></div><div class="public anchor" id="var-augment-plan"><h3>augment-plan</h3><div class="usage"><code>(augment-plan merchant world plan)</code></div><div class="doc"><div class="markdown"><p>Augment this <code>plan</code> constructed in this <code>world</code> for this <code>merchant</code> with the <code>:quantity</code> of goods which should be bought and the <code>:expected-profit</code> of the trade.</p>
|
||
<p>Returns the augmented plan.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/cc/journeyman/the_great_game/merchants/planning.clj#L110">view source</a></div></div><div class="public anchor" id="var-generate-trade-plans"><h3>generate-trade-plans</h3><div class="usage"><code>(generate-trade-plans merchant world commodity)</code></div><div class="doc"><div class="markdown"><p>Generate all possible trade plans for this <code>merchant</code> and this <code>commodity</code> in this <code>world</code>.</p>
|
||
<p>Returned plans are maps with keys:</p>
|
||
<ul>
|
||
<li>:merchant - the id of the <code>merchant</code> for whom the plan was created;</li>
|
||
<li>:origin - the city from which the trade starts;</li>
|
||
<li>:destination - the city to which the trade is planned;</li>
|
||
<li>:commodity - the <code>commodity</code> to be carried;</li>
|
||
<li>:buy-price - the price at which that <code>commodity</code> can be bought;</li>
|
||
<li>:expected-price - the price at which the <code>merchant</code> anticipates that <code>commodity</code> can be sold;</li>
|
||
<li>:distance - the number of stages in the planned journey</li>
|
||
<li>:dist-to-home - the distance from <code>destination</code> to the <code>merchant</code>’s home city.</li>
|
||
</ul></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/cc/journeyman/the_great_game/merchants/planning.clj#L11">view source</a></div></div><div class="public anchor" id="var-nearest-with-targets"><h3>nearest-with-targets</h3><div class="usage"><code>(nearest-with-targets plans targets)</code></div><div class="doc"><div class="markdown"><p>Return the distance to the nearest destination among those of these <code>plans</code> which match these <code>targets</code>. Plans are expected to be plans as returned by <code>generate-trade-plans</code>, q.v.; <code>targets</code> are expected to be as accepted by <code>make-target-filter</code>, q.v.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/cc/journeyman/the_great_game/merchants/planning.clj#L54">view source</a></div></div><div class="public anchor" id="var-plan-trade"><h3>plan-trade</h3><div class="usage"><code>(plan-trade merchant world commodity)</code></div><div class="doc"><div class="markdown"><p>Find the best destination in this <code>world</code> for this <code>commodity</code> given this <code>merchant</code> and this <code>origin</code>. 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. <code>merchant</code> may be passed as a map or a keyword; <code>commodity</code> should be passed as a keyword.</p>
|
||
<p>The returned plan is a map with keys:</p>
|
||
<ul>
|
||
<li>:merchant - the id of the <code>merchant</code> for whom the plan was created;</li>
|
||
<li>:origin - the city from which the trade starts;</li>
|
||
<li>:destination - the city to which the trade is planned;</li>
|
||
<li>:commodity - the <code>commodity</code> to be carried;</li>
|
||
<li>:buy-price - the price at which that <code>commodity</code> can be bought;</li>
|
||
<li>:expected-price - the price at which the <code>merchant</code> anticipates that <code>commodity</code> can be sold;</li>
|
||
<li>:distance - the number of stages in the planned journey</li>
|
||
<li>:dist-to-home - the distance from <code>destination</code> to the <code>merchant</code>’s home city.</li>
|
||
</ul></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/cc/journeyman/the_great_game/merchants/planning.clj#L68">view source</a></div></div><div class="public anchor" id="var-select-cargo"><h3>select-cargo</h3><div class="usage"><code>(select-cargo merchant world)</code></div><div class="doc"><div class="markdown"><p>A <code>merchant</code>, in a given location in a <code>world</code>, 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.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/cc/journeyman/the_great_game/merchants/planning.clj#L128">view source</a></div></div></div></body></html> |