<p>terra is a <strong>super customizable</strong> framework for creating and analyzing biological simulations. It's open-source and licenced under MIT.</p>
<p>This creature is valid, but it's pretty boring. To make a more interesting creature, let's override some of the default <adata-scrollhref="#options">options</a> and <adata-scrollhref="#methods">methods</a>.</p>
<p>To run a simulation, we'll need to create an environment. Let's make a 25x25 grid and populate 40% of the space with our first creature and 20% with our second.</p>
<p>Terrariums have a few methods that allow you to interact with the simulation. The most important are <codeclass="language-javascript">step</code> and <codeclass="language-javascript">draw</code>.</p>
// start an interval to update the simulation twice per second
var updater = setInterval(stepAndDraw, 500);</code></pre>
<p><codeclass="language-javascript">step</code> can take an argument for the number of steps to run through. If we want to see how our environment is doing in 1000 steps, we can simply run:</p>
<p>The following options can be passed in an object to creatureFactory.register( ) as the first argument.</p>
<h3>Required</h3>
<ul>
<li>(string) type: </li>
</ul>
<h3>Optional</h3>
<ul>
<li>(array) color: </li>
<li>(int) initialEnergy: </li>
<li>(int) maxEnergy: </li>
<li>(int) metabolism: </li>
<li>(int) size: </li>
<li>(int) speed: </li>
<li>(int) vision: </li>
<li>(int) sustainability: 2</li>
<li>(float) reproduceLv: 0.70</li>
<li>(float) moveLv: 0.20</li>
<li>(char) character: </li>
</ul>
<h2id="methods">Methods</h2>
<ul>
<li>queue</li>
<li>reproduce</li>
<li>move</li>
<li>wait</li>
<li>isDead</li>
<li>boundEnergy</li>
</ul>
<h2id="events">Events</h2>
<ul>
<li>finished</li>
</ul>
</div>
<footer>Created with ❤ by <ahref="http://rileyjshaw.com">rileyjshaw</a>. Inspired by <ahref="http://eloquentjavascript.net/">Marijn Haverbeke</a> and <ahref="https://www.wolframscience.com/">Stephen Wolfram</a>.</footer>