Update 2015-03-13T04:14:45.018Z

This commit is contained in:
Riley Shaw 2015-03-13 00:14:45 -04:00
parent 92767f67ef
commit 5d6c0adbd5

View File

@ -198,7 +198,7 @@ elementary.animate();</code></pre>
<p>The following methods and attributes can be passed in an object as the first argument:</p> <p>The following methods and attributes can be passed in an object as the first argument:</p>
<h3 id="creatureOptions">Required</h3> <h3 id="creatureOptions">Required</h3>
<ul class="defaults"> <ul class="defaults">
<li> <li id="type">
<h4><span class="token keyword">string</span> type</h4> <h4><span class="token keyword">string</span> type</h4>
<p>Creature type, to be used later in <a data-scroll href="#terrariumMethods" class="token function">makeGrid( )</a> or <a data-scroll href="#terrariumMethods" class="token function">makeGridWithDistribution( )</a>.</p> <p>Creature type, to be used later in <a data-scroll href="#terrariumMethods" class="token function">makeGrid( )</a> or <a data-scroll href="#terrariumMethods" class="token function">makeGridWithDistribution( )</a>.</p>
</li> </li>
@ -213,14 +213,14 @@ elementary.animate();</code></pre>
<li>Default: 1</li> <li>Default: 1</li>
</ul> </ul>
</li> </li>
<li> <li id="character">
<h4><span class="token keyword">char</span> character</h4> <h4><span class="token keyword">char</span> character</h4>
<p>ASCII character used to visually represent a creature.</p> <p>ASCII character used to visually represent a creature.</p>
<ul> <ul>
<li>Default: undefined (fills cell)</li> <li>Default: undefined (fills cell)</li>
</ul> </ul>
</li> </li>
<li> <li id="color">
<h4><span class="token keyword">int [3]</span> color</h4> <h4><span class="token keyword">int [3]</span> color</h4>
<p>RGB components of a creature's display color.</p> <p>RGB components of a creature's display color.</p>
<ul> <ul>
@ -228,14 +228,14 @@ elementary.animate();</code></pre>
<li>Default: random</li> <li>Default: random</li>
</ul> </ul>
</li> </li>
<li> <li id="colorFn">
<h4><span class="token keyword">function</span> colorFn</h4> <h4><span class="token keyword">function</span> colorFn</h4>
<p>How a creature's color is determined at each step.</p> <p>How a creature's color is determined at each step.</p>
<ul> <ul>
<li>Returns: <span class="mono"><span class="token keyword">string</span></span> of comma-separated RGBA components.</li> <li>Returns: <span class="mono"><span class="token keyword">string</span></span> of comma-separated RGBA components.</li>
</ul> </ul>
</li> </li>
<li> <li id="efficiency">
<h4><span class="token keyword">int</span> efficiency</h4> <h4><span class="token keyword">int</span> efficiency</h4>
<p>Conversion ratio of food to energy. Food energy &times; efficiency = gained energy.</p> <p>Conversion ratio of food to energy. Food energy &times; efficiency = gained energy.</p>
<ul> <ul>
@ -250,7 +250,7 @@ elementary.animate();</code></pre>
<li>Default: 50</li> <li>Default: 50</li>
</ul> </ul>
</li> </li>
<li> <li id="isDead">
<h4><span class="token keyword">function</span> isDead</h4> <h4><span class="token keyword">function</span> isDead</h4>
<p>Determines whether a creature should be removed at the beginning of a step.</p> <p>Determines whether a creature should be removed at the beginning of a step.</p>
<ul> <ul>
@ -266,7 +266,7 @@ elementary.animate();</code></pre>
<li>Minimum: 0</li> <li>Minimum: 0</li>
</ul> </ul>
</li> </li>
<li> <li id="move">
<h4><span class="token keyword">function</span> move</h4> <h4><span class="token keyword">function</span> move</h4>
<p>How a creature moves.</p> <p>How a creature moves.</p>
<ul> <ul>
@ -275,7 +275,7 @@ elementary.animate();</code></pre>
<li>Returns: <span class="mono">{x, y, creature, successFn} || false</span></li> <li>Returns: <span class="mono">{x, y, creature, successFn} || false</span></li>
</ul> </ul>
</li> </li>
<li> <li id="moveLv">
<h4><span class="token keyword">float</span> moveLv</h4> <h4><span class="token keyword">float</span> moveLv</h4>
<p></p> <p></p>
<ul> <ul>
@ -299,7 +299,7 @@ elementary.animate();</code></pre>
</li> </li>
</ul> </ul>
</li> </li>
<li> <li id="reproduce">
<h4><span class="token keyword">function</span> reproduce</h4> <h4><span class="token keyword">function</span> reproduce</h4>
<p>How a creature reproduces.</p> <p>How a creature reproduces.</p>
<ul> <ul>
@ -308,7 +308,7 @@ elementary.animate();</code></pre>
<li>Returns: <span class="mono">{x, y, creature, successFn, failureFn} || false</span></li> <li>Returns: <span class="mono">{x, y, creature, successFn, failureFn} || false</span></li>
</ul> </ul>
</li> </li>
<li> <li id="reproduceLv">
<h4><span class="token keyword">float</span> reproduceLv</h4> <h4><span class="token keyword">float</span> reproduceLv</h4>
<p>Percentage of a creature's max energy above which it will reproduce (used in the default <a data-scroll href="#process">process</a> method).</p> <p>Percentage of a creature's max energy above which it will reproduce (used in the default <a data-scroll href="#process">process</a> method).</p>
<ul> <ul>
@ -316,14 +316,14 @@ elementary.animate();</code></pre>
<li>Range: [0, 1]</li> <li>Range: [0, 1]</li>
</ul> </ul>
</li> </li>
<li> <li id="size">
<h4><span class="token keyword">int</span> size</h4> <h4><span class="token keyword">int</span> size</h4>
<p>A creature's size; by default, creatures can only eat creatures smaller than them.</p> <p>A creature's size; by default, creatures can only eat creatures smaller than them.</p>
<ul> <ul>
<li>Default: 50</li> <li>Default: 50</li>
</ul> </ul>
</li> </li>
<li> <li id="sustainability">
<h4><span class="token keyword">int</span> sustainability</h4> <h4><span class="token keyword">int</span> sustainability</h4>
<p>Number of visible food sources needed before a creature will eat.</p> <p>Number of visible food sources needed before a creature will eat.</p>
<ul> <ul>
@ -331,7 +331,7 @@ elementary.animate();</code></pre>
<li>Range: (0, 16 &times; <a data-scroll href="#actionRadius">actionRadius</a> - 8]</li> <li>Range: (0, 16 &times; <a data-scroll href="#actionRadius">actionRadius</a> - 8]</li>
</ul> </ul>
</li> </li>
<li> <li id="wait">
<h4><span class="token keyword">function</span> wait</h4> <h4><span class="token keyword">function</span> wait</h4>
<p>What happens when a creature waits.</p> <p>What happens when a creature waits.</p>
<ul> <ul>
@ -361,50 +361,50 @@ var t = new terra.Terrarium(4, 4, {
});</code></pre> });</code></pre>
<h3>Required</h3> <h3>Required</h3>
<ul class="defaults"> <ul class="defaults">
<li> <li id="width">
<h4><span class="token keyword">int</span> width</h4> <h4><span class="token keyword">int</span> width</h4>
<p>Number of cells in the x-direction.</p> <p>Number of cells in the x-direction.</p>
</li> </li>
<li> <li id="height">
<h4><span class="token keyword">int</span> height</h4> <h4><span class="token keyword">int</span> height</h4>
<p>Number of cells in the y-direction.</p> <p>Number of cells in the y-direction.</p>
</li> </li>
</ul> </ul>
<h3>Optional</h3> <h3>Optional</h3>
<ul class="defaults"> <ul class="defaults">
<li> <li id="id">
<h4><span class="token keyword">string</span> id</h4> <h4><span class="token keyword">string</span> id</h4>
<p>id assigned to the generated canvas.</p> <p>id assigned to the generated canvas.</p>
</li> </li>
<li> <li id="cellSize">
<h4><span class="token keyword">int</span> cellSize</h4> <h4><span class="token keyword">int</span> cellSize</h4>
<p>Pixel width of each cell.</p> <p>Pixel width of each cell.</p>
<ul> <ul>
<li>Default: 10</li> <li>Default: 10</li>
</ul> </ul>
</li> </li>
<li> <li id="insertAfter">
<h4><span class="token keyword">string</span> insertAfter</h4> <h4><span class="token keyword">string</span> insertAfter</h4>
<p>id of the element to insert the canvas after.</p> <p>id of the element to insert the canvas after.</p>
<ul> <ul>
<li>Default: canvas is appended to <code class="language-markup">document.body</code></li> <li>Default: canvas is appended to <code class="language-markup">document.body</code></li>
</ul> </ul>
</li> </li>
<li> <li id="periodic">
<h4><span class="token keyword">boolean</span> periodic</h4> <h4><span class="token keyword">boolean</span> periodic</h4>
<p>Determines if boundaries wrap around; a creature at the top of a periodic map would see the bottom cells as though they were adjacent.</p> <p>Determines if boundaries wrap around; a creature at the top of a periodic map would see the bottom cells as though they were adjacent.</p>
<ul> <ul>
<li>Default: false</li> <li>Default: false</li>
</ul> </ul>
</li> </li>
<li> <li id="neighborhood">
<h4><span class="token keyword">string</span> neighborhood</h4> <h4><span class="token keyword">string</span> neighborhood</h4>
<p>Defines neighborhood type as either <a href="http://en.wikipedia.org/wiki/Moore_neighborhood"><code class="language-javascript">moore</code></a> or <a href="http://en.wikipedia.org/wiki/Von_Neumann_neighborhood"><code class="language-javascript">vonNeumann</code></a>.</p> <p>Defines neighborhood type as either <a href="http://en.wikipedia.org/wiki/Moore_neighborhood"><code class="language-javascript">moore</code></a> or <a href="http://en.wikipedia.org/wiki/Von_Neumann_neighborhood"><code class="language-javascript">vonNeumann</code></a>.</p>
<ul> <ul>
<li>Default: moore</li> <li>Default: moore</li>
</ul> </ul>
</li> </li>
<li> <li id="trails">
<h4><span class="token keyword">float</span> trails</h4> <h4><span class="token keyword">float</span> trails</h4>
<p>Allows for "trails", which visualize system history. A value of 1 shows all past state; trails fade faster as we approach 0.</p> <p>Allows for "trails", which visualize system history. A value of 1 shows all past state; trails fade faster as we approach 0.</p>
<ul> <ul>
@ -413,7 +413,7 @@ var t = new terra.Terrarium(4, 4, {
<li>Dependencies: "background" option is required if trails is set.</li> <li>Dependencies: "background" option is required if trails is set.</li>
</ul> </ul>
</li> </li>
<li> <li id="background">
<h4><span class="token keyword">int [3]</span> background</h4> <h4><span class="token keyword">int [3]</span> background</h4>
<p>RGB components of the canvas' background.</p> <p>RGB components of the canvas' background.</p>
<ul> <ul>