Drainage is now *mostly* working...

not sure about rivers flowing out of lakes.
This commit is contained in:
Simon Brooke 2024-04-06 16:54:10 +01:00
parent e19ce2e5f7
commit c739dd7094
12 changed files with 126 additions and 97 deletions

View file

@ -1,11 +1,12 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>Mw-engine 0.2.0-SNAPSHOT</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">Mw-engine</span> <span class="project-version">0.2.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 current"><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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="namespace-index" id="content"><h1><span class="project-title"><span class="project-name">Mw-engine</span> <span class="project-version">0.2.0-SNAPSHOT</span></span></h1><h5 class="license">Released under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License v2</a></h5><div class="doc"><p>Cellular automaton world builder.</p></div><h2>Installation</h2><p>To install, add the following dependency to your project or build file:</p><pre class="deps">[mw-engine "0.2.0-SNAPSHOT"]</pre><h2>Topics</h2><ul class="topics"><li><a href="intro.html">Introduction to mw-engine</a></li></ul><h2>Namespaces</h2><div class="namespace"><h3><a href="mw-engine.core.html">mw-engine.core</a></h3><div class="doc"><div class="markdown"><p>Functions to transform a world and run rules.</p> <html><head><meta charset="UTF-8" /><title>Mw-engine 0.3.0-SNAPSHOT</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">Mw-engine</span> <span class="project-version">0.3.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 current"><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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="namespace-index" id="content"><h1><span class="project-title"><span class="project-name">Mw-engine</span> <span class="project-version">0.3.0-SNAPSHOT</span></span></h1><h5 class="license">Released under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License v2</a></h5><div class="doc"><p>Cellular automaton world builder.</p></div><h2>Installation</h2><p>To install, add the following dependency to your project or build file:</p><pre class="deps">[mw-engine "0.3.0-SNAPSHOT"]</pre><h2>Topics</h2><ul class="topics"><li><a href="intro.html">Introduction to mw-engine</a></li></ul><h2>Namespaces</h2><div class="namespace"><h3><a href="mw-engine.core.html">mw-engine.core</a></h3><div class="doc"><div class="markdown"><p>Functions to transform a world and run rules.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.core.html#var-apply-rule">apply-rule</a> </li><li> <a href="mw-engine.core.html#var-run-world">run-world</a> </li><li> <a href="mw-engine.core.html#var-transform-world">transform-world</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.display.html">mw-engine.display</a></h3><div class="doc"><div class="markdown"><p>Simple functions to allow a world to be visualised.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.core.html#var-*with-history*">*with-history*</a> </li><li> <a href="mw-engine.core.html#var-apply-rule">apply-rule</a> </li><li> <a href="mw-engine.core.html#var-known-rule-types">known-rule-types</a> </li><li> <a href="mw-engine.core.html#var-run-world">run-world</a> </li><li> <a href="mw-engine.core.html#var-transform-world">transform-world</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.display.html">mw-engine.display</a></h3><div class="doc"><div class="markdown"><p>Simple functions to allow a world to be visualised.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.display.html#var-*image-base*">*image-base*</a> </li><li> <a href="mw-engine.display.html#var-format-css-class">format-css-class</a> </li><li> <a href="mw-engine.display.html#var-format-image-path">format-image-path</a> </li><li> <a href="mw-engine.display.html#var-format-mouseover">format-mouseover</a> </li><li> <a href="mw-engine.display.html#var-render-cell">render-cell</a> </li><li> <a href="mw-engine.display.html#var-render-world-row">render-world-row</a> </li><li> <a href="mw-engine.display.html#var-render-world-table">render-world-table</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.drainage.html">mw-engine.drainage</a></h3><div class="doc"><div class="markdown"><p>Experimental, probably of no interest to anyone else; attempt to compute drainage on a world, assumed to have altitudes already set from a heightmap.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.display.html#var-*image-base*">*image-base*</a> </li><li> <a href="mw-engine.display.html#var-format-css-class">format-css-class</a> </li><li> <a href="mw-engine.display.html#var-format-image-path">format-image-path</a> </li><li> <a href="mw-engine.display.html#var-format-mouseover">format-mouseover</a> </li><li> <a href="mw-engine.display.html#var-render-cell">render-cell</a> </li><li> <a href="mw-engine.display.html#var-render-world-row">render-world-row</a> </li><li> <a href="mw-engine.display.html#var-render-world-table">render-world-table</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.drainage.html">mw-engine.drainage</a></h3><div class="doc"><div class="markdown"><p>Experimental, probably of no interest to anyone else; attempt to compute drainage on a world, assumed to have altitudes already set from a heightmap.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.drainage.html#var-*sealevel*">*sealevel*</a> </li><li> <a href="mw-engine.drainage.html#var-explore-lake">explore-lake</a> </li><li> <a href="mw-engine.drainage.html#var-find-lakes">find-lakes</a> </li><li> <a href="mw-engine.drainage.html#var-flood-hollow">flood-hollow</a> </li><li> <a href="mw-engine.drainage.html#var-flood-hollows">flood-hollows</a> </li><li> <a href="mw-engine.drainage.html#var-flow">flow</a> </li><li> <a href="mw-engine.drainage.html#var-flow-contributors">flow-contributors</a> </li><li> <a href="mw-engine.drainage.html#var-flow-nr">flow-nr</a> </li><li> <a href="mw-engine.drainage.html#var-flow-world">flow-world</a> </li><li> <a href="mw-engine.drainage.html#var-flow-world-nr">flow-world-nr</a> </li><li> <a href="mw-engine.drainage.html#var-is-hollow">is-hollow</a> </li><li> <a href="mw-engine.drainage.html#var-is-lake.3F">is-lake?</a> </li><li> <a href="mw-engine.drainage.html#var-max-altitude">max-altitude</a> </li><li> <a href="mw-engine.drainage.html#var-rain-row">rain-row</a> </li><li> <a href="mw-engine.drainage.html#var-rain-world">rain-world</a> </li><li> <a href="mw-engine.drainage.html#var-rainfall">rainfall</a> </li><li> <a href="mw-engine.drainage.html#var-run-drainage">run-drainage</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.flow.html">mw-engine.flow</a></h3><div class="doc"><div class="markdown"><p>Allow flows of values between cells in the world.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.drainage.html#var-*sealevel*">*sealevel*</a> </li><li> <a href="mw-engine.drainage.html#var-explore-lake">explore-lake</a> </li><li> <a href="mw-engine.drainage.html#var-find-lakes">find-lakes</a> </li><li> <a href="mw-engine.drainage.html#var-flood-hollow">flood-hollow</a> </li><li> <a href="mw-engine.drainage.html#var-flood-hollows">flood-hollows</a> </li><li> <a href="mw-engine.drainage.html#var-flow">flow</a> </li><li> <a href="mw-engine.drainage.html#var-flow-contributors">flow-contributors</a> </li><li> <a href="mw-engine.drainage.html#var-flow-nr">flow-nr</a> </li><li> <a href="mw-engine.drainage.html#var-flow-world">flow-world</a> </li><li> <a href="mw-engine.drainage.html#var-flow-world-nr">flow-world-nr</a> </li><li> <a href="mw-engine.drainage.html#var-is-hollow">is-hollow</a> </li><li> <a href="mw-engine.drainage.html#var-is-lake.3F">is-lake?</a> </li><li> <a href="mw-engine.drainage.html#var-max-altitude">max-altitude</a> </li><li> <a href="mw-engine.drainage.html#var-rain-row">rain-row</a> </li><li> <a href="mw-engine.drainage.html#var-rain-world">rain-world</a> </li><li> <a href="mw-engine.drainage.html#var-rainfall">rainfall</a> </li><li> <a href="mw-engine.drainage.html#var-run-drainage">run-drainage</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.flow.html">mw-engine.flow</a></h3><div class="doc"><div class="markdown"><p>Allow flows of values between cells in the world.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.flow.html#var-coordinate.3F">coordinate?</a> </li><li> <a href="mw-engine.flow.html#var-create-flow-fraction">create-flow-fraction</a> </li><li> <a href="mw-engine.flow.html#var-create-flow-percent">create-flow-percent</a> </li><li> <a href="mw-engine.flow.html#var-create-flow-quantity">create-flow-quantity</a> </li><li> <a href="mw-engine.flow.html#var-create-location">create-location</a> </li><li> <a href="mw-engine.flow.html#var-execute">execute</a> </li><li> <a href="mw-engine.flow.html#var-execute-flows">execute-flows</a> </li><li> <a href="mw-engine.flow.html#var-flow.3F">flow?</a> </li><li> <a href="mw-engine.flow.html#var-location.3F">location?</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.heightmap.html">mw-engine.heightmap</a></h3><div class="doc"><div class="markdown"><p>Functions to apply a heightmap to a world.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.flow.html#var-coordinate.3F">coordinate?</a> </li><li> <a href="mw-engine.flow.html#var-create-flow-fraction">create-flow-fraction</a> </li><li> <a href="mw-engine.flow.html#var-create-flow-percent">create-flow-percent</a> </li><li> <a href="mw-engine.flow.html#var-create-flow-quantity">create-flow-quantity</a> </li><li> <a href="mw-engine.flow.html#var-create-location">create-location</a> </li><li> <a href="mw-engine.flow.html#var-execute">execute</a> </li><li> <a href="mw-engine.flow.html#var-execute-flows">execute-flows</a> </li><li> <a href="mw-engine.flow.html#var-flow-world">flow-world</a> </li><li> <a href="mw-engine.flow.html#var-flow.3F">flow?</a> </li><li> <a href="mw-engine.flow.html#var-location.3F">location?</a> </li><li> <a href="mw-engine.flow.html#var-plan-flows">plan-flows</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.heightmap.html">mw-engine.heightmap</a></h3><div class="doc"><div class="markdown"><p>Functions to apply a heightmap to a world.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.heightmap.html#var-apply-heightmap">apply-heightmap</a> </li><li> <a href="mw-engine.heightmap.html#var-apply-valuemap">apply-valuemap</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-altitude">tag-altitude</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-gradient">tag-gradient</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-gradients">tag-gradients</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-property">tag-property</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.natural-rules.html">mw-engine.natural-rules</a></h3><div class="doc"><div class="markdown"><p>A set of MicroWorld rules describing a simplified natural ecosystem.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.heightmap.html#var-apply-heightmap">apply-heightmap</a> </li><li> <a href="mw-engine.heightmap.html#var-apply-valuemap">apply-valuemap</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-altitude">tag-altitude</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-gradient">tag-gradient</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-gradients">tag-gradients</a> </li><li> <a href="mw-engine.heightmap.html#var-tag-property">tag-property</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.natural-rules.html">mw-engine.natural-rules</a></h3><div class="doc"><div class="markdown"><p>A set of MicroWorld rules describing a simplified natural ecosystem.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.natural-rules.html#var-herbivore-rules">herbivore-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-init-rules">init-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-lightning-probability">lightning-probability</a> </li><li> <a href="mw-engine.natural-rules.html#var-natural-rules">natural-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-predator-rules">predator-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-snowline">snowline</a> </li><li> <a href="mw-engine.natural-rules.html#var-treeline">treeline</a> </li><li> <a href="mw-engine.natural-rules.html#var-vegetation-rules">vegetation-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-waterline">waterline</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.utils.html">mw-engine.utils</a></h3><div class="doc"><div class="markdown"><p>Utility functions needed by MicroWorld and, specifically, in the interpretation of MicroWorld rule.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.natural-rules.html#var-herbivore-rules">herbivore-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-init-rules">init-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-lightning-probability">lightning-probability</a> </li><li> <a href="mw-engine.natural-rules.html#var-natural-rules">natural-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-predator-rules">predator-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-snowline">snowline</a> </li><li> <a href="mw-engine.natural-rules.html#var-treeline">treeline</a> </li><li> <a href="mw-engine.natural-rules.html#var-vegetation-rules">vegetation-rules</a> </li><li> <a href="mw-engine.natural-rules.html#var-waterline">waterline</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.render.html">mw-engine.render</a></h3><div class="doc"><div class="markdown"><p>Render a world as HTML.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.utils.html#var-get-cell">get-cell</a> </li><li> <a href="mw-engine.utils.html#var-get-int">get-int</a> </li><li> <a href="mw-engine.utils.html#var-get-int-or-zero">get-int-or-zero</a> </li><li> <a href="mw-engine.utils.html#var-get-least-cell">get-least-cell</a> </li><li> <a href="mw-engine.utils.html#var-get-most-cell">get-most-cell</a> </li><li> <a href="mw-engine.utils.html#var-get-neighbours">get-neighbours</a> </li><li> <a href="mw-engine.utils.html#var-get-neighbours-with-property-value">get-neighbours-with-property-value</a> </li><li> <a href="mw-engine.utils.html#var-get-neighbours-with-state">get-neighbours-with-state</a> </li><li> <a href="mw-engine.utils.html#var-get-num">get-num</a> </li><li> <a href="mw-engine.utils.html#var-in-bounds">in-bounds</a> </li><li> <a href="mw-engine.utils.html#var-in-bounds.3F">in-bounds?</a> </li><li> <a href="mw-engine.utils.html#var-init-generation">init-generation</a> </li><li> <a href="mw-engine.utils.html#var-map-world">map-world</a> </li><li> <a href="mw-engine.utils.html#var-map-world-n-n">map-world-n-n</a> </li><li> <a href="mw-engine.utils.html#var-map-world-p-p">map-world-p-p</a> </li><li> <a href="mw-engine.utils.html#var-member.3F">member?</a> </li><li> <a href="mw-engine.utils.html#var-memo-get-neighbours">memo-get-neighbours</a> </li><li> <a href="mw-engine.utils.html#var-merge-cell">merge-cell</a> </li><li> <a href="mw-engine.utils.html#var-population">population</a> </li><li> <a href="mw-engine.utils.html#var-set-property">set-property</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.world.html">mw-engine.world</a></h3><div class="doc"><div class="markdown"><p>Functions to create and to print two dimensional cellular automata.</p> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.render.html#var-*state-images-relative-path*">*state-images-relative-path*</a> </li><li> <a href="mw-engine.render.html#var-format-css-class">format-css-class</a> </li><li> <a href="mw-engine.render.html#var-format-image-path">format-image-path</a> </li><li> <a href="mw-engine.render.html#var-format-mouseover">format-mouseover</a> </li><li> <a href="mw-engine.render.html#var-render-cell">render-cell</a> </li><li> <a href="mw-engine.render.html#var-render-world-page">render-world-page</a> </li><li> <a href="mw-engine.render.html#var-render-world-row">render-world-row</a> </li><li> <a href="mw-engine.render.html#var-render-world-table">render-world-table</a> </li><li> <a href="mw-engine.render.html#var-world-.3Ehtml-file">world-&gt;html-file</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.utils.html">mw-engine.utils</a></h3><div class="doc"><div class="markdown"><p>Utility functions needed by MicroWorld and, specifically, in the interpretation of MicroWorld rule.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.world.html#var-format-cell">format-cell</a> </li><li> <a href="mw-engine.world.html#var-make-cell">make-cell</a> </li><li> <a href="mw-engine.world.html#var-make-world">make-world</a> </li><li> <a href="mw-engine.world.html#var-print-world">print-world</a> </li><li> <a href="mw-engine.world.html#var-truncate-state">truncate-state</a> </li></ul></div></div></div></body></html> </div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.utils.html#var-add-history-event">add-history-event</a> </li><li> <a href="mw-engine.utils.html#var-get-cell">get-cell</a> </li><li> <a href="mw-engine.utils.html#var-get-int">get-int</a> </li><li> <a href="mw-engine.utils.html#var-get-int-or-zero">get-int-or-zero</a> </li><li> <a href="mw-engine.utils.html#var-get-least-cell">get-least-cell</a> </li><li> <a href="mw-engine.utils.html#var-get-most-cell">get-most-cell</a> </li><li> <a href="mw-engine.utils.html#var-get-neighbours">get-neighbours</a> </li><li> <a href="mw-engine.utils.html#var-get-neighbours-with-property-value">get-neighbours-with-property-value</a> </li><li> <a href="mw-engine.utils.html#var-get-neighbours-with-state">get-neighbours-with-state</a> </li><li> <a href="mw-engine.utils.html#var-get-num">get-num</a> </li><li> <a href="mw-engine.utils.html#var-history-string">history-string</a> </li><li> <a href="mw-engine.utils.html#var-in-bounds">in-bounds</a> </li><li> <a href="mw-engine.utils.html#var-in-bounds.3F">in-bounds?</a> </li><li> <a href="mw-engine.utils.html#var-init-generation">init-generation</a> </li><li> <a href="mw-engine.utils.html#var-map-world">map-world</a> </li><li> <a href="mw-engine.utils.html#var-map-world-n-n">map-world-n-n</a> </li><li> <a href="mw-engine.utils.html#var-map-world-p-p">map-world-p-p</a> </li><li> <a href="mw-engine.utils.html#var-member.3F">member?</a> </li><li> <a href="mw-engine.utils.html#var-memo-get-neighbours">memo-get-neighbours</a> </li><li> <a href="mw-engine.utils.html#var-merge-cell">merge-cell</a> </li><li> <a href="mw-engine.utils.html#var-population">population</a> </li><li> <a href="mw-engine.utils.html#var-rule-type">rule-type</a> </li><li> <a href="mw-engine.utils.html#var-set-property">set-property</a> </li><li> <a href="mw-engine.utils.html#var-summarise-history">summarise-history</a> </li></ul></div></div><div class="namespace"><h3><a href="mw-engine.world.html">mw-engine.world</a></h3><div class="doc"><div class="markdown"><p>Functions to create and to print two dimensional cellular automata.</p>
</div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="mw-engine.world.html#var-cell.3F">cell?</a> </li><li> <a href="mw-engine.world.html#var-format-cell">format-cell</a> </li><li> <a href="mw-engine.world.html#var-make-cell">make-cell</a> </li><li> <a href="mw-engine.world.html#var-make-world">make-world</a> </li><li> <a href="mw-engine.world.html#var-print-world">print-world</a> </li><li> <a href="mw-engine.world.html#var-truncate-state">truncate-state</a> </li><li> <a href="mw-engine.world.html#var-world.3F">world?</a> </li></ul></div></div></div></body></html>

View file

@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>Introduction to mw-engine</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">Mw-engine</span> <span class="project-version">0.2.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 current"><a href="intro.html"><div class="inner"><span>Introduction to mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#introduction-to-mw-engine" id="introduction-to-mw-engine"></a>Introduction to mw-engine</h1> <html><head><meta charset="UTF-8" /><title>Introduction to mw-engine</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">Mw-engine</span> <span class="project-version">0.3.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 current"><a href="intro.html"><div class="inner"><span>Introduction to mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#introduction-to-mw-engine" id="introduction-to-mw-engine"></a>Introduction to mw-engine</h1>
<p>TODO: write <a href="http://jacobian.org/writing/great-documentation/what-to-write/">great documentation</a></p> <p>TODO: write <a href="http://jacobian.org/writing/great-documentation/what-to-write/">great documentation</a></p>
</div></div></div></body></html> </div></div></div></body></html>

View file

@ -1,19 +1,22 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>mw-engine.core 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">Mw-engine</span> <span class="project-version">0.2.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch current"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.core.html#var-apply-rule"><div class="inner"><span>apply-rule</span></div></a></li><li class="depth-1"><a href="mw-engine.core.html#var-run-world"><div class="inner"><span>run-world</span></div></a></li><li class="depth-1"><a href="mw-engine.core.html#var-transform-world"><div class="inner"><span>transform-world</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.core</h1><div class="doc"><div class="markdown"><p>Functions to transform a world and run rules.</p> <html><head><meta charset="UTF-8" /><title>mw-engine.core 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">Mw-engine</span> <span class="project-version">0.3.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch current"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.core.html#var-*with-history*"><div class="inner"><span>*with-history*</span></div></a></li><li class="depth-1"><a href="mw-engine.core.html#var-apply-rule"><div class="inner"><span>apply-rule</span></div></a></li><li class="depth-1"><a href="mw-engine.core.html#var-known-rule-types"><div class="inner"><span>known-rule-types</span></div></a></li><li class="depth-1"><a href="mw-engine.core.html#var-run-world"><div class="inner"><span>run-world</span></div></a></li><li class="depth-1"><a href="mw-engine.core.html#var-transform-world"><div class="inner"><span>transform-world</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.core</h1><div class="doc"><div class="markdown"><p>Functions to transform a world and run rules.</p>
<p>Every rule is a function of two arguments, a cell and a world. If the rule fires, it returns a new cell, which should have the same values for <code>:x</code> and <code>:y</code> as the old cell. Anything else can be modified.</p> <p>Every rule is a function of two arguments, a cell and a world. If the rule fires, it returns a new cell, which should have the same values for <code>:x</code> and <code>:y</code> as the old cell. Anything else can be modified.</p>
<p>While any function of two arguments can be used as a rule, a special high level rule language is provided by the <code>mw-parser</code> package, which compiles rules expressed in a subset of English rules into suitable functions.</p> <p>While any function of two arguments can be used as a rule, a special high level rule language is provided by the <code>mw-parser</code> package, which compiles rules expressed in a subset of English rules into suitable functions.</p>
<p>A cell is a map containing at least values for the keys :x, :y, and :state; a transformation should not alter the values of :x or :y, and should not return a cell without a keyword as the value of :state. Anything else is legal.</p> <p>A cell is a map containing at least values for the keys :x, :y, and :state; a transformation should not alter the values of :x or :y, and should not return a cell without a keyword as the value of :state. Anything else is legal.</p>
<p>A world is a two dimensional matrix (sequence of sequences) of cells, such that every cells <code>:x</code> and <code>:y</code> properties reflect its place in the matrix. See <code>world.clj</code>.</p> <p>A world is a two dimensional matrix (sequence of sequences) of cells, such that every cells <code>:x</code> and <code>:y</code> properties reflect its place in the matrix. See <code>world.clj</code>.</p>
<p>Each time the world is transformed (see <code>transform-world</code>), for each cell, rules are applied in turn until one matches. Once one rule has matched no further rules can be applied to that cell.</p> <p>Each time the world is transformed (see <code>transform-world</code>), for each cell, rules are applied in turn until one matches. Once one rule has matched no further rules can be applied to that cell.</p>
</div></div><div class="public anchor" id="var-apply-rule"><h3>apply-rule</h3><div class="usage"><code>(apply-rule world cell rule)</code><code>(apply-rule world cell rule source)</code></div><div class="doc"><div class="markdown"><p>Apply a single <code>rule</code> to a <code>cell</code>. What this is about is that I want to be able, for debugging purposes, to tag a cell with the rule text of the rule which fired (and especially so when an exception is thrown. So a rule may be either an ifn, or a list (ifn source-text). This function deals with despatching on those two possibilities. <code>world</code> is also passed in in order to be able to access neighbours.</p> </div></div><div class="public anchor" id="var-*with-history*"><h3>*with-history*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>I suspect that caching history on the cells is greatly worsening the memory problems. Make it optional, but by default false.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L51">view source</a></div></div><div class="public anchor" id="var-run-world"><h3>run-world</h3><div class="usage"><code>(run-world world init-rules rules generations)</code></div><div class="doc"><div class="markdown"><p>Run this world with these rules for this number of generations.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L53">view source</a></div></div><div class="public anchor" id="var-apply-rule"><h3>apply-rule</h3><div class="usage"><code>(apply-rule world cell rule)</code></div><div class="doc"><div class="markdown"><p>Apply a single <code>rule</code> to a <code>cell</code>. What this is about is that I want to be able, for debugging purposes, to tag a cell with the rule text of the rule which fired (and especially so when an exception is thrown).</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L62">view source</a></div></div><div class="public anchor" id="var-known-rule-types"><h3>known-rule-types</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Types of rules we know about.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L58">view source</a></div></div><div class="public anchor" id="var-run-world"><h3>run-world</h3><div class="usage"><code>(run-world world rules generations)</code><code>(run-world world init-rules rules generations)</code></div><div class="doc"><div class="markdown"><p>Run this <code>world</code> with these <code>rules</code> for this number of <code>generations</code>.</p>
<ul> <ul>
<li><code>world</code> a world as discussed above;</li> <li><code>world</code> a world as discussed above;</li>
<li><code>init-rules</code> a sequence of rules as defined above, to be run once to initialise the world;</li> <li><code>init-rules</code> a sequence of rules as defined above, to be run once to initialise the world;</li>
<li><code>rules</code> a sequence of rules as defined above, to be run iteratively for each generation;</li> <li><code>rules</code> a sequence of rules as defined above, to be run iteratively for each generation;</li>
<li><code>generations</code> an (integer) number of generations.</li> <li><code>generations</code> an (integer) number of generations.</li>
</ul> </ul>
<p><strong>NOTE THAT</strong> all rules <strong>must</strong> be tagged with <code>rule-type</code> metadata, or they <strong>will not</strong> be executed.</p>
<p>Return the final generation of the world.</p> <p>Return the final generation of the world.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L98">view source</a></div></div><div class="public anchor" id="var-transform-world"><h3>transform-world</h3><div class="usage"><code>(transform-world world rules)</code></div><div class="doc"><div class="markdown"><p>Return a world derived from this <code>world</code> by applying these <code>rules</code> to each cell.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L130">view source</a></div></div><div class="public anchor" id="var-transform-world"><h3>transform-world</h3><div class="usage"><code>(transform-world world rules)</code></div><div class="doc"><div class="markdown"><p>Return a world derived from this <code>world</code> by applying the production rules found among these <code>rules</code> to each cell.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L93">view source</a></div></div></div></body></html> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/core.clj#L119">view source</a></div></div></div></body></html>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>mw-engine.display 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">Mw-engine</span> <span class="project-version">0.2.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch current"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.display.html#var-*image-base*"><div class="inner"><span>*image-base*</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-format-css-class"><div class="inner"><span>format-css-class</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-format-image-path"><div class="inner"><span>format-image-path</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-format-mouseover"><div class="inner"><span>format-mouseover</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-render-cell"><div class="inner"><span>render-cell</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-render-world-row"><div class="inner"><span>render-world-row</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-render-world-table"><div class="inner"><span>render-world-table</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.display</h1><div class="doc"><div class="markdown"><p>Simple functions to allow a world to be visualised.</p> <html><head><meta charset="UTF-8" /><title>mw-engine.display 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">Mw-engine</span> <span class="project-version">0.3.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch current"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.display.html#var-*image-base*"><div class="inner"><span>*image-base*</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-format-css-class"><div class="inner"><span>format-css-class</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-format-image-path"><div class="inner"><span>format-image-path</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-format-mouseover"><div class="inner"><span>format-mouseover</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-render-cell"><div class="inner"><span>render-cell</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-render-world-row"><div class="inner"><span>render-world-row</span></div></a></li><li class="depth-1"><a href="mw-engine.display.html#var-render-world-table"><div class="inner"><span>render-world-table</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.display</h1><div class="doc"><div class="markdown"><p>Simple functions to allow a world to be visualised.</p>
</div></div><div class="public anchor" id="var-*image-base*"><h3>*image-base*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Base url (i.e., url of directory) from which to load tile images.</p> </div></div><div class="public anchor" id="var-*image-base*"><h3>*image-base*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Base url (i.e., url of directory) from which to load tile images.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/display.clj#L28">view source</a></div></div><div class="public anchor" id="var-format-css-class"><h3>format-css-class</h3><div class="usage"><code>(format-css-class state)</code></div><div class="doc"><div class="markdown"><p>Format this <code>state</code>, assumed to be a keyword indicating a state in the world, into a CSS class</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/display.clj#L28">view source</a></div></div><div class="public anchor" id="var-format-css-class"><h3>format-css-class</h3><div class="usage"><code>(format-css-class state)</code></div><div class="doc"><div class="markdown"><p>Format this <code>state</code>, assumed to be a keyword indicating a state in the world, into a CSS class</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/display.clj#L32">view source</a></div></div><div class="public anchor" id="var-format-image-path"><h3>format-image-path</h3><div class="usage"><code>(format-image-path state)</code></div><div class="doc"><div class="markdown"><p>Render this <code>state</code>, assumed to be a keyword indicating a state in the world, into a path which should recover the corresponding image file.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/display.clj#L32">view source</a></div></div><div class="public anchor" id="var-format-image-path"><h3>format-image-path</h3><div class="usage"><code>(format-image-path state)</code></div><div class="doc"><div class="markdown"><p>Render this <code>state</code>, assumed to be a keyword indicating a state in the world, into a path which should recover the corresponding image file.</p>

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>mw-engine.flow 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">Mw-engine</span> <span class="project-version">0.2.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch current"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.flow.html#var-coordinate.3F"><div class="inner"><span>coordinate?</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-flow-fraction"><div class="inner"><span>create-flow-fraction</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-flow-percent"><div class="inner"><span>create-flow-percent</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-flow-quantity"><div class="inner"><span>create-flow-quantity</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-location"><div class="inner"><span>create-location</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-execute"><div class="inner"><span>execute</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-execute-flows"><div class="inner"><span>execute-flows</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-flow.3F"><div class="inner"><span>flow?</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-location.3F"><div class="inner"><span>location?</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.flow</h1><div class="doc"><div class="markdown"><p>Allow flows of values between cells in the world.</p> <html><head><meta charset="UTF-8" /><title>mw-engine.flow 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">Mw-engine</span> <span class="project-version">0.3.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch current"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.flow.html#var-coordinate.3F"><div class="inner"><span>coordinate?</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-flow-fraction"><div class="inner"><span>create-flow-fraction</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-flow-percent"><div class="inner"><span>create-flow-percent</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-flow-quantity"><div class="inner"><span>create-flow-quantity</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-create-location"><div class="inner"><span>create-location</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-execute"><div class="inner"><span>execute</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-execute-flows"><div class="inner"><span>execute-flows</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-flow-world"><div class="inner"><span>flow-world</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-flow.3F"><div class="inner"><span>flow?</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-location.3F"><div class="inner"><span>location?</span></div></a></li><li class="depth-1"><a href="mw-engine.flow.html#var-plan-flows"><div class="inner"><span>plan-flows</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.flow</h1><div class="doc"><div class="markdown"><p>Allow flows of values between cells in the world.</p>
<p>The design here is: a flow object is a map with the following properties:</p> <p>The design here is: a flow object is a map with the following properties:</p>
<ol> <ol>
<li><code>:source</code>, whose value is a location;</li> <li><code>:source</code>, whose value is a location;</li>
@ -16,12 +16,14 @@
<p>To execute a flow is transfer the quantity specified of the property specified from the cell at the source specified to the cell at the destination specified; if the source doesnt have sufficient of the property, then all it has should be transferred, but no more: properties to be flowed cannot be pulled negative.</p> <p>To execute a flow is transfer the quantity specified of the property specified from the cell at the source specified to the cell at the destination specified; if the source doesnt have sufficient of the property, then all it has should be transferred, but no more: properties to be flowed cannot be pulled negative.</p>
<p>Flowing values through the world is consequently a two stage process: firstly theres a planning stage, in which all the flows to be executed are computed without changing the world, and then an execution stage, where theyre all executed. This namespace deals with mainly with execution.</p> <p>Flowing values through the world is consequently a two stage process: firstly theres a planning stage, in which all the flows to be executed are computed without changing the world, and then an execution stage, where theyre all executed. This namespace deals with mainly with execution.</p>
</div></div><div class="public anchor" id="var-coordinate.3F"><h3>coordinate?</h3><div class="usage"><code>(coordinate? o world)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if this object <code>o</code> is a valid coordinate with respect to this <code>world</code>, else <code>false</code>. Assumes square worlds.</p> </div></div><div class="public anchor" id="var-coordinate.3F"><h3>coordinate?</h3><div class="usage"><code>(coordinate? o world)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if this object <code>o</code> is a valid coordinate with respect to this <code>world</code>, else <code>false</code>. Assumes square worlds.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L51">view source</a></div></div><div class="public anchor" id="var-create-flow-fraction"><h3>create-flow-fraction</h3><h4 class="type">macro</h4><div class="usage"><code>(create-flow-fraction source dest prop fraction)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L52">view source</a></div></div><div class="public anchor" id="var-create-flow-fraction"><h3>create-flow-fraction</h3><h4 class="type">macro</h4><div class="usage"><code>(create-flow-fraction source dest prop fraction)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L134">view source</a></div></div><div class="public anchor" id="var-create-flow-percent"><h3>create-flow-percent</h3><h4 class="type">macro</h4><div class="usage"><code>(create-flow-percent source dest prop percent)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L172">view source</a></div></div><div class="public anchor" id="var-create-flow-percent"><h3>create-flow-percent</h3><h4 class="type">macro</h4><div class="usage"><code>(create-flow-percent source dest prop percent)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L139">view source</a></div></div><div class="public anchor" id="var-create-flow-quantity"><h3>create-flow-quantity</h3><h4 class="type">macro</h4><div class="usage"><code>(create-flow-quantity source dest prop quantity)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L177">view source</a></div></div><div class="public anchor" id="var-create-flow-quantity"><h3>create-flow-quantity</h3><h4 class="type">macro</h4><div class="usage"><code>(create-flow-quantity source dest prop quantity)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L127">view source</a></div></div><div class="public anchor" id="var-create-location"><h3>create-location</h3><h4 class="type">macro</h4><div class="usage"><code>(create-location cell)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L165">view source</a></div></div><div class="public anchor" id="var-create-location"><h3>create-location</h3><h4 class="type">macro</h4><div class="usage"><code>(create-location cell)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L123">view source</a></div></div><div class="public anchor" id="var-execute"><h3>execute</h3><div class="usage"><code>(execute world flow)</code></div><div class="doc"><div class="markdown"><p>Return a world like this <code>world</code>, except with the quantity of the property described in this <code>flow</code> object transferred from the source of that flow to its destination.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L161">view source</a></div></div><div class="public anchor" id="var-execute"><h3>execute</h3><div class="usage"><code>(execute world flow)</code></div><div class="doc"><div class="markdown"><p>Return a world like this <code>world</code>, except with the quantity of the property described in this <code>flow</code> object transferred from the source of that flow to its destination.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L89">view source</a></div></div><div class="public anchor" id="var-execute-flows"><h3>execute-flows</h3><div class="usage"><code>(execute-flows world flows)</code></div><div class="doc"><div class="markdown"><p>Return a world like this <code>world</code>, but with each of these flows executed.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L90">view source</a></div></div><div class="public anchor" id="var-execute-flows"><h3>execute-flows</h3><div class="usage"><code>(execute-flows world flows)</code></div><div class="doc"><div class="markdown"><p>Return a world like this <code>world</code>, but with each of these flows executed.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L116">view source</a></div></div><div class="public anchor" id="var-flow.3F"><h3>flow?</h3><div class="usage"><code>(flow? o world)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if this object <code>o</code> is a flow as defined above with respect to this <code>world</code>, else <code>false</code>. Assumes square worlds.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L123">view source</a></div></div><div class="public anchor" id="var-flow-world"><h3>flow-world</h3><div class="usage"><code>(flow-world world rules)</code></div><div class="doc"><div class="markdown"><p>Return a world derived from this <code>world</code> by applying the flow rules found among these <code>rules</code> to each cell, and executing all the flows planned.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L75">view source</a></div></div><div class="public anchor" id="var-location.3F"><h3>location?</h3><div class="usage"><code>(location? o world)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if this object <code>o</code> is a location as defined above with respect to this <code>world</code>, else <code>false</code>.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L152">view source</a></div></div><div class="public anchor" id="var-flow.3F"><h3>flow?</h3><div class="usage"><code>(flow? o world)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if this object <code>o</code> is a flow as defined above with respect to this <code>world</code>, else <code>false</code>. Assumes square worlds.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L62">view source</a></div></div></div></body></html> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L76">view source</a></div></div><div class="public anchor" id="var-location.3F"><h3>location?</h3><div class="usage"><code>(location? o world)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if this object <code>o</code> is a location as defined above with respect to this <code>world</code>, else <code>false</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L63">view source</a></div></div><div class="public anchor" id="var-plan-flows"><h3>plan-flows</h3><div class="usage"><code>(plan-flows world rules)</code></div><div class="doc"><div class="markdown"><p>Plan, but do not execute, all the flows in this <code>world</code> implied by those of these <code>rules</code> (which are expected to be pre-compiled) which are flow rules. Return the list of plans, as flow objects.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/flow.clj#L140">view source</a></div></div></div></body></html>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>mw-engine.heightmap 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">Mw-engine</span> <span class="project-version">0.2.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch current"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.heightmap.html#var-apply-heightmap"><div class="inner"><span>apply-heightmap</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-apply-valuemap"><div class="inner"><span>apply-valuemap</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-altitude"><div class="inner"><span>tag-altitude</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-gradient"><div class="inner"><span>tag-gradient</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-gradients"><div class="inner"><span>tag-gradients</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-property"><div class="inner"><span>tag-property</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.heightmap</h1><div class="doc"><div class="markdown"><p>Functions to apply a heightmap to a world.</p> <html><head><meta charset="UTF-8" /><title>mw-engine.heightmap 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">Mw-engine</span> <span class="project-version">0.3.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch current"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.heightmap.html#var-apply-heightmap"><div class="inner"><span>apply-heightmap</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-apply-valuemap"><div class="inner"><span>apply-valuemap</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-altitude"><div class="inner"><span>tag-altitude</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-gradient"><div class="inner"><span>tag-gradient</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-gradients"><div class="inner"><span>tag-gradients</span></div></a></li><li class="depth-1"><a href="mw-engine.heightmap.html#var-tag-property"><div class="inner"><span>tag-property</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.heightmap</h1><div class="doc"><div class="markdown"><p>Functions to apply a heightmap to a world.</p>
<p>Heightmaps are considered only as greyscale images, so colour is redundent (will be ignored). Darker shades are higher.</p> <p>Heightmaps are considered only as greyscale images, so colour is redundent (will be ignored). Darker shades are higher.</p>
</div></div><div class="public anchor" id="var-apply-heightmap"><h3>apply-heightmap</h3><div class="usage"><code>(apply-heightmap world imagepath)</code><code>(apply-heightmap imagepath)</code></div><div class="doc"><div class="markdown"><p>Apply the image file loaded from this path to this world, and return a world whose altitudes are modified (added to) by the altitudes in the heightmap. It is assumed that the heightmap is at least as large in x and y dimensions as the world. Note that, in addition to setting the <code>:altitude</code> of each cell, this function also sets the <code>:gradient</code>.</p> </div></div><div class="public anchor" id="var-apply-heightmap"><h3>apply-heightmap</h3><div class="usage"><code>(apply-heightmap world imagepath)</code><code>(apply-heightmap imagepath)</code></div><div class="doc"><div class="markdown"><p>Apply the image file loaded from this path to this world, and return a world whose altitudes are modified (added to) by the altitudes in the heightmap. It is assumed that the heightmap is at least as large in x and y dimensions as the world. Note that, in addition to setting the <code>:altitude</code> of each cell, this function also sets the <code>:gradient</code>.</p>
<ul> <ul>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>mw-engine.natural-rules 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">Mw-engine</span> <span class="project-version">0.2.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch current"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.natural-rules.html#var-herbivore-rules"><div class="inner"><span>herbivore-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-init-rules"><div class="inner"><span>init-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-lightning-probability"><div class="inner"><span>lightning-probability</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-natural-rules"><div class="inner"><span>natural-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-predator-rules"><div class="inner"><span>predator-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-snowline"><div class="inner"><span>snowline</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-treeline"><div class="inner"><span>treeline</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-vegetation-rules"><div class="inner"><span>vegetation-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-waterline"><div class="inner"><span>waterline</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.natural-rules</h1><div class="doc"><div class="markdown"><p>A set of MicroWorld rules describing a simplified natural ecosystem.</p> <html><head><meta charset="UTF-8" /><title>mw-engine.natural-rules 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">Mw-engine</span> <span class="project-version">0.3.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch current"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2"><a href="mw-engine.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="mw-engine.natural-rules.html#var-herbivore-rules"><div class="inner"><span>herbivore-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-init-rules"><div class="inner"><span>init-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-lightning-probability"><div class="inner"><span>lightning-probability</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-natural-rules"><div class="inner"><span>natural-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-predator-rules"><div class="inner"><span>predator-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-snowline"><div class="inner"><span>snowline</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-treeline"><div class="inner"><span>treeline</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-vegetation-rules"><div class="inner"><span>vegetation-rules</span></div></a></li><li class="depth-1"><a href="mw-engine.natural-rules.html#var-waterline"><div class="inner"><span>waterline</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.natural-rules</h1><div class="doc"><div class="markdown"><p>A set of MicroWorld rules describing a simplified natural ecosystem.</p>
<p>Since the completion of the rule language this is more or less obsolete - there are still a few things that you can do with rules written in Clojure that you cant do in the rule language, but not many and I doubt theyre important.</p> <p>Since the completion of the rule language this is more or less obsolete - there are still a few things that you can do with rules written in Clojure that you cant do in the rule language, but not many and I doubt theyre important.</p>
</div></div><div class="public anchor" id="var-herbivore-rules"><h3>herbivore-rules</h3><div class="usage"></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p> </div></div><div class="public anchor" id="var-herbivore-rules"><h3>herbivore-rules</h3><div class="usage"></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/natural_rules.clj#L101">view source</a></div></div><div class="public anchor" id="var-init-rules"><h3>init-rules</h3><div class="usage"></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/natural_rules.clj#L101">view source</a></div></div><div class="public anchor" id="var-init-rules"><h3>init-rules</h3><div class="usage"></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>

File diff suppressed because one or more lines are too long

View file

@ -1,23 +1,25 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>mw-engine.world 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">Mw-engine</span> <span class="project-version">0.2.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 current"><a href="mw-engine.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="mw-engine.world.html#var-format-cell"><div class="inner"><span>format-cell</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-make-cell"><div class="inner"><span>make-cell</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-make-world"><div class="inner"><span>make-world</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-print-world"><div class="inner"><span>print-world</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-truncate-state"><div class="inner"><span>truncate-state</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.world</h1><div class="doc"><div class="markdown"><p>Functions to create and to print two dimensional cellular automata.</p> <html><head><meta charset="UTF-8" /><title>mw-engine.world 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">Mw-engine</span> <span class="project-version">0.3.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 mw-engine</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>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.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 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.render.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>render</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.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-2 current"><a href="mw-engine.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="mw-engine.world.html#var-cell.3F"><div class="inner"><span>cell?</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-format-cell"><div class="inner"><span>format-cell</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-make-cell"><div class="inner"><span>make-cell</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-make-world"><div class="inner"><span>make-world</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-print-world"><div class="inner"><span>print-world</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-truncate-state"><div class="inner"><span>truncate-state</span></div></a></li><li class="depth-1"><a href="mw-engine.world.html#var-world.3F"><div class="inner"><span>world?</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.world</h1><div class="doc"><div class="markdown"><p>Functions to create and to print two dimensional cellular automata.</p>
<p>Nothing in this namespace should determine what states are possible within the automaton, except for the initial state, :new.</p> <p>Nothing in this namespace should determine what states are possible within the automaton, except for the initial state, :new.</p>
<p>A cell is a map containing at least values for the keys <code>:x</code>, <code>:y</code>, and <code>:state</code>.</p> <p>A cell is a map containing at least values for the keys <code>:x</code>, <code>:y</code>, and <code>:state</code>.</p>
<p>A world is a two dimensional matrix (sequence of sequences) of cells, such that every cells <code>:x</code> and <code>:y</code> properties reflect its place in the matrix.</p> <p>A world is a two dimensional matrix (sequence of sequences) of cells, such that every cells <code>:x</code> and <code>:y</code> properties reflect its place in the matrix.</p>
</div></div><div class="public anchor" id="var-format-cell"><h3>format-cell</h3><div class="usage"><code>(format-cell cell)</code></div><div class="doc"><div class="markdown"><p>Return a formatted string summarising the current state of this cell.</p> </div></div><div class="public anchor" id="var-cell.3F"><h3>cell?</h3><div class="usage"><code>(cell? obj)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if <code>obj</code> is a cell, as understood by MicroWorld, else <code>false</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L65">view source</a></div></div><div class="public anchor" id="var-make-cell"><h3>make-cell</h3><h4 class="type">macro</h4><div class="usage"><code>(make-cell x y)</code></div><div class="doc"><div class="markdown"><p>Create a minimal default cell at x, y</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L38">view source</a></div></div><div class="public anchor" id="var-format-cell"><h3>format-cell</h3><div class="usage"><code>(format-cell cell)</code></div><div class="doc"><div class="markdown"><p>Return a formatted string summarising the current state of this cell.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L89">view source</a></div></div><div class="public anchor" id="var-make-cell"><h3>make-cell</h3><h4 class="type">macro</h4><div class="usage"><code>(make-cell x y)</code></div><div class="doc"><div class="markdown"><p>Create a minimal default cell at x, y</p>
<ul> <ul>
<li><code>x</code> the x coordinate at which this cell is created;</li> <li><code>x</code> the x coordinate at which this cell is created;</li>
<li><code>y</code> the y coordinate at which this cell is created.</li> <li><code>y</code> the y coordinate at which this cell is created.</li>
</ul> </ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L38">view source</a></div></div><div class="public anchor" id="var-make-world"><h3>make-world</h3><div class="usage"><code>(make-world width height)</code></div><div class="doc"><div class="markdown"><p>Make a world width cells from east to west, and height cells from north to south.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L56">view source</a></div></div><div class="public anchor" id="var-make-world"><h3>make-world</h3><div class="usage"><code>(make-world width height)</code></div><div class="doc"><div class="markdown"><p>Make a world width cells from east to west, and height cells from north to south.</p>
<ul> <ul>
<li><code>width</code> a natural number representing the width of the matrix to be created;</li> <li><code>width</code> a natural number representing the width of the matrix to be created;</li>
<li><code>height</code> a natural number representing the height of the matrix to be created.</li> <li><code>height</code> a natural number representing the height of the matrix to be created.</li>
</ul> </ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L46">view source</a></div></div><div class="public anchor" id="var-print-world"><h3>print-world</h3><div class="usage"><code>(print-world world)</code></div><div class="doc"><div class="markdown"><p>Print the current state of this world, and return nil.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L64">view source</a></div></div><div class="public anchor" id="var-print-world"><h3>print-world</h3><div class="usage"><code>(print-world world)</code></div><div class="doc"><div class="markdown"><p>Print the current state of this world, and return nil.</p>
<ul> <ul>
<li><code>world</code> a world as defined above.</li> <li><code>world</code> a world as defined above.</li>
</ul> </ul>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L78">view source</a></div></div><div class="public anchor" id="var-truncate-state"><h3>truncate-state</h3><div class="usage"><code>(truncate-state cell limit)</code></div><div class="doc"><div class="markdown"><p>Truncate the print name of the state of this cell to at most limit characters.</p> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L100">view source</a></div></div><div class="public anchor" id="var-truncate-state"><h3>truncate-state</h3><div class="usage"><code>(truncate-state cell limit)</code></div><div class="doc"><div class="markdown"><p>Truncate the print name of the state of this cell to at most limit characters.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L58">view source</a></div></div></div></body></html> </div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L76">view source</a></div></div><div class="public anchor" id="var-world.3F"><h3>world?</h3><div class="usage"><code>(world? obj)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if <code>obj</code> is a world, as understood by MicroWorld, else <code>false</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/world.clj#L48">view source</a></div></div></div></body></html>

View file

@ -84,9 +84,10 @@
"Simulate rainfall on this `world`. TODO: Doesn't really work just now - should "Simulate rainfall on this `world`. TODO: Doesn't really work just now - should
rain more on west-facing slopes, and less to the east of high ground" rain more on west-facing slopes, and less to the east of high ground"
[world] [world]
(map (info "rain-world started.")
rain-row (let [w' (into [] (map #(apply vector (rain-row %)) world))]
world)) (info "rain-world completed")
w'))
(defn flow-contributors (defn flow-contributors
@ -134,9 +135,11 @@
"Flood all local hollows in this `world`. At this stage only floods single "Flood all local hollows in this `world`. At this stage only floods single
cell hollows." cell hollows."
[world] [world]
(map-world world (info "flood-hollows started.")
#(if (is-hollow %1 %2) (flood-hollow %1 %2) %2))) (let [w' (map-world world
#(if (is-hollow %1 %2) (flood-hollow %1 %2) %2))]
(info "flood-hollows completed")
w'))
(def max-altitude 255) (def max-altitude 255)
@ -157,12 +160,6 @@
(get-int-or-zero % :flow)) (get-int-or-zero % :flow))
contributors))}))))) contributors))})))))
(defn flow-nr-wrapper
[cell world]
(do
(info (format "Flowing cell at %d, %d" (:x cell) (:y cell)))
(flow-nr cell world)))
(def flow (def flow
"Compute the total flow upstream of this `cell` in this `world`, and return a cell identical "Compute the total flow upstream of this `cell` in this `world`, and return a cell identical
to this one but having a value of its flow property set from that computation. The function is to this one but having a value of its flow property set from that computation. The function is
@ -185,13 +182,19 @@
(defn flow-world-nr (defn flow-world-nr
"Experimental non-recursive flow-world algorithm" "Experimental non-recursive flow-world algorithm"
[world] [world]
(run-world world (list (vary-meta flow-nr assoc :rule-type :ad-hoc)) max-altitude)) (info "Non recursive flow-world started.")
(let [w' (run-world world (list (vary-meta flow-nr assoc :rule-type :ad-hoc)) max-altitude)]
(info "Non recursive flow-world completed")
w'))
(defn flow-world (defn flow-world
"Return a world like this `world`, but with cells tagged with the amount of "Return a world like this `world`, but with cells tagged with the amount of
water flowing through them." water flowing through them."
[world] [world]
(map-world (rain-world world) flow)) (info "Recursive flow-world started.")
(let [w' (map-world (rain-world world) flow)]
(info "Recursive flow-world completed")
w'))
(defn explore-lake (defn explore-lake
"Return a sequence of cells starting with this `cell` in this `world` which "Return a sequence of cells starting with this `cell` in this `world` which
@ -202,23 +205,34 @@
"If this `cell` in this `world` is not part of a lake, return nil. If it is, "If this `cell` in this `world` is not part of a lake, return nil. If it is,
return a cell like this `cell` tagged as part of a lake." return a cell like this `cell` tagged as part of a lake."
[world cell] [world cell]
(if (cond
;; if it's already tagged as a lake, it's a lake ;; if it's already tagged as a lake, it's a lake
(:lake cell) cell (:lake cell) cell
(let (#{:lake :sea :water} (:state cell)) cell ;; if it's already tagged as
[outflow (apply min (map :altitude (get-neighbours world cell)))] ;; wet, no need for change
(when-not (and (integer? (:x cell)) (integer? (:y cell)))
(> (:altitude cell) outflow) (let
(assoc cell :lake true :state :lake))))) [outflow (apply min (map :altitude (get-neighbours world cell)))]
(when-not
(> (:altitude cell) outflow)
(do
(info (format "tagging cell at %d, %d as lake" (:x cell) (:y cell)))
(assoc cell :lake true :state :lake))))
:else (throw (ex-info "Invalid cell?"
{:cell cell}))))
(defn find-lakes (defn find-lakes
[_world]) "Identify cells in this `world` which are lakes."
[world]
(info "find-lakes started.")
(let [w' (map-world world is-lake?)]
(info "find-lakes completed.")
w'))
(defn run-drainage (defn run-drainage
"Create a world from the heightmap `hmap`, rain on it, and then compute river "Create a world from the heightmap `hmap`, rain on it, and then compute river
flows." flows."
[hmap] [hmap]
(flow-world (rain-world (flood-hollows (apply-heightmap hmap))))) (find-lakes (flow-world-nr (rain-world (flood-hollows (apply-heightmap hmap))))))
;; (run-drainage "resources/heightmaps/20x20/crucible.png") ;; (run-drainage "resources/heightmaps/20x20/crucible.png")

View file

@ -198,7 +198,10 @@
Gets the neighbours within the specified distance of the cell at Gets the neighbours within the specified distance of the cell at
coordinates [x,y] in this world." coordinates [x,y] in this world."
([world x y depth] ([world x y depth]
(memo-get-neighbours world x y depth)) (if (and (integer? x) (integer? y) (integer? depth))
(memo-get-neighbours world x y depth)
(throw (ex-info "get-neighbours: integer arguments expected."
{:x x :y y :depth depth}))))
([world cell depth] ([world cell depth]
(memo-get-neighbours world (:x cell) (:y cell) depth)) (memo-get-neighbours world (:x cell) (:y cell) depth))
([world cell] ([world cell]