17 lines
8.5 KiB
HTML
17 lines
8.5 KiB
HTML
<!DOCTYPE html PUBLIC ""
|
||
"">
|
||
<html><head><meta charset="UTF-8" /><title>the-great-game.merchants.merchants 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.0-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="intro.html"><div class="inner"><span>Introduction to the-great-game</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>the-great-game</span></div></div></li><li class="depth-2 branch"><a href="the-great-game.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></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>merchants</span></div></div></li><li class="depth-3 current"><a href="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-2 branch"><a href="the-great-game.utils.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>utils</span></div></a></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>world</span></div></div></li><li class="depth-3 branch"><a href="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-3"><a href="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="the-great-game.merchants.merchants.html#var-augment-plan"><div class="inner"><span>augment-plan</span></div></a></li><li class="depth-1"><a href="the-great-game.merchants.merchants.html#var-burden"><div class="inner"><span>burden</span></div></a></li><li class="depth-1"><a href="the-great-game.merchants.merchants.html#var-expected-price"><div class="inner"><span>expected-price</span></div></a></li><li class="depth-1"><a href="the-great-game.merchants.merchants.html#var-find-trade-plan"><div class="inner"><span>find-trade-plan</span></div></a></li><li class="depth-1"><a href="the-great-game.merchants.merchants.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">the-great-game.merchants.merchants</h1><div class="doc"><div class="markdown"><p>Trade planning for merchants, primarily.</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/the_great_game/merchants/merchants.clj#L101">view source</a></div></div><div class="public anchor" id="var-burden"><h3>burden</h3><div class="usage"><code>(burden merchant world)</code></div><div class="doc"><div class="markdown"><p>The total weight of the current cargo carried by this <code>merchant</code> in this <code>world</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/the_great_game/merchants/merchants.clj#L21">view source</a></div></div><div class="public anchor" id="var-expected-price"><h3>expected-price</h3><div class="usage"><code>(expected-price merchant commodity city)</code></div><div class="doc"><div class="markdown"><p>Find the price anticipated, given this <code>world</code>, by this <code>merchant</code> for this <code>commodity</code> in this <code>city</code>. If no information, assume 1. <code>merchant</code> should be passed as a map, <code>commodity</code> and <code>city</code> should be passed as keywords.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/the_great_game/merchants/merchants.clj#L7">view source</a></div></div><div class="public anchor" id="var-find-trade-plan"><h3>find-trade-plan</h3><div class="usage"><code>(find-trade-plan 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>
|
||
<h1><a href="#merchant-the-id-of-the-for-whom-the-plan-was-created-" name="merchant-the-id-of-the-for-whom-the-plan-was-created-"></a>:merchant - the id of the <code>merchant</code> for whom the plan was created;</h1>
|
||
<h1><a href="#origin-the-city-from-which-the-trade-starts-" name="origin-the-city-from-which-the-trade-starts-"></a>:origin - the city from which the trade starts;</h1>
|
||
<h1><a href="#destination-the-city-to-which-the-trade-is-planned-" name="destination-the-city-to-which-the-trade-is-planned-"></a>:destination - the city to which the trade is planned;</h1>
|
||
<h1><a href="#commodity-the-to-be-carried-" name="commodity-the-to-be-carried-"></a>:commodity - the <code>commodity</code> to be carried;</h1>
|
||
<h1><a href="#buy-price-the-price-at-which-that-can-be-bought-" name="buy-price-the-price-at-which-that-can-be-bought-"></a>:buy-price - the price at which that <code>commodity</code> can be bought;</h1>
|
||
<h1><a href="#expected-price-the-price-at-which-the-anticipates" name="expected-price-the-price-at-which-the-anticipates"></a>:expected-price - the price at which the <code>merchant</code> anticipates</h1>
|
||
<pre><code>that `commodity` can be sold;
|
||
</code></pre>
|
||
<h1><a href="#distance-the-number-of-stages-in-the-planned-journey" name="distance-the-number-of-stages-in-the-planned-journey"></a>:distance - the number of stages in the planned journey</h1>
|
||
<h1><a href="#dist-to-home-the-distance-from-to-the-s" name="dist-to-home-the-distance-from-to-the-s"></a>:dist-to-home - the distance from <code>destination</code> to the <code>merchant</code>’s</h1>
|
||
<pre><code>home city.
|
||
</code></pre></div></div><div class="src-link"><a href="https://github.com/simon-brooke/the-great-game/blob/master/src/the_great_game/merchants/merchants.clj#L39">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/the_great_game/merchants/merchants.clj#L125">view source</a></div></div></div></body></html> |