!function t(e,n,r){function o(a,u){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a=o?"sticky":""}function n(t,e){var n=function(){setTimeout(function(){t(),requestAnimationFrame(n)},1e3/e)};requestAnimationFrame(n)}var r=t("../../app/terrarium.js");t("./bugs.js"),t("../../bower_components/smooth-scroll.js/dist/js/bind-polyfill.min.js"),t("../../bower_components/smooth-scroll.js/dist/js/smooth-scroll.min.js").init({offset:60});var o=window.innerHeight,i=document.documentElement.clientWidth,a=Math.ceil(o/20),u=Math.ceil(i/20),c=new r(u,a,"topTerrarium",20,document.getElementById("header"));c.canvas.style.top=c.canvas.style.left="50%",c.canvas.style.marginTop=-10*a+"px",c.canvas.style.marginLeft=-10*u+"px",c.populate([["plant",50],["wimp",10],["bully",5]]);var s=new r(25,25,"golTerrarium",10,document.getElementById("gol"));s.populate([["GoL",100]]),c.draw(),s.draw(),n(function(){c.grid=c.step(),c.draw(),s.grid=s.step(),s.draw()},1e3),document.addEventListener("scroll",e)},{"../../app/terrarium.js":5,"../../bower_components/smooth-scroll.js/dist/js/bind-polyfill.min.js":8,"../../bower_components/smooth-scroll.js/dist/js/smooth-scroll.min.js":9,"./bugs.js":10}],2:[function(t,e){var n=t("./util.js"),r=function(){function t(){this.age=0}t.prototype.initialEnergy=50,t.prototype.maxEnergy=100,t.prototype.metabolism=.7,t.prototype.size=50,t.prototype.speed=1,t.prototype.vision=1,t.prototype.sustainability=2,t.prototype.reproduceLv=.7,t.prototype.moveLv=.2,t.prototype.boundEnergy=function(){this.energy>this.maxEnergy&&(this.energy=this.maxEnergy)},t.prototype.isDead=function(){return this.energy<=0},t.prototype.reproduce=function(t){var e=n.filter(t,function(t){return!t.creature});if(e.length){var o=e[n.random(e.length-1)],i=o.coords,a=r.make(this.type),u=function(){return this.energy-=this.initialEnergy,!0}.bind(this),c=this.wait;return{x:i.x,y:i.y,creature:a,successFn:u,failureFn:c}}return!1},t.prototype.move=function(t){var e=this,r=n.filter(t,function(t){return t.creature.sizethis.maxEnergy*this.reproduceLv&&this.reproduce?e=this.reproduce(t):this.energy>this.moveLv&&this.move&&(e=this.move(t));var n=e.creature;return n?(n.successFn=e.successFn||n.wait,n.failureFn=e.failureFn||n.wait,{x:e.x,y:e.y,creature:n}):!1};var e={};return{make:function(t,n){var r=e[t];return r?new r(n):!1},register:function(r,o){var i=r.type,a=r.color;return"string"==typeof i&&"undefined"==typeof e[i]&&"object"==typeof a&&3===a.length?(e[i]="function"==typeof o?function(){this.energy=this.initialEnergy,o.call(this)}:function(){this.energy=this.initialEnergy},e[i].prototype=new t,e[i].prototype.constructor=e[i],n.each(r,function(t,n){e[i].prototype[n]=t}),e[i].prototype.successFn=e[i].wait,e[i].prototype.failureFn=e[i].wait,e[i].prototype.energy=r.initialEnergy,!0):!1}}}();e.exports=r},{"./util.js":6}],3:[function(t,e){var n=t("./util.js");e.exports=function(t,e,r){var o=t.getContext("2d");o.font="bold "+r+"px Arial",o.clearRect(0,0,t.width,t.height),n.each(e,function(t,e){n.each(t,function(t,n){if(t){var i=t.colorFn?t.colorFn():t.color+","+t.energy/t.maxEnergy;o.fillStyle="rgba("+i+")",t.character?o.fillText(t.character,e*r,n*r+r):o.fillRect(e*r,n*r,r,r)}})})}},{"./util.js":6}],4:[function(t,e){var n=function(t,e,n,r){function o(r){var o=document.createElement("canvas");return r=function(){var t=document.createElement("canvas").getContext("2d"),e=window.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return e/n}(),o.width=t*r,o.height=e*r,o.style.width=t+"px",o.style.height=e+"px",o.getContext("2d").setTransform(r,0,0,r,0,0),o.id=n,o}var i=o();return r?r.parentNode.insertBefore(i,r.nextSibling):document.body.appendChild(i),i};e.exports={createCanvasElement:n}},{}],5:[function(t,e){function n(t,e,n,r,o){this.width=t,this.height=e,this.cellSize=r||10,this.grid=[],this.canvas=a.createCanvasElement(t*r,e*r,n,o)}var r=t("./util"),o=t("./creature.js"),i=t("./display.js"),a=t("./dom.js");n.prototype.populate=function(t,e){function n(t,e){var n=t+e[1];return!i&&n>a&&(i=o.make(e[0])),n}var i,a=0;e||(e=this.grid);for(var u=this.width;u--;)if(e[u]=[],t)for(var c=this.height;c--;)i=!1,a=r.random(99,!0),r.reduce(t,n,0),e[u].push(i)},n.prototype.step=function(t){function e(t){if(t){var e=r.assign(new t.constructor,t);return e.isDead()?!1:e}return!1}function n(t){return r.map(t,e)}function o(t){return{coords:t,creature:y[t.x][t.y]}}function i(t){var e=t.creature;e?(e.failureFn(),e.boundEnergy()):(t.wait(),t.boundEnergy())}function a(t,e,n){if(t){var a=r.map(r.getNeighborCoords(e,n,p-1,h-1,t.vision),o),u=t.queue(a);if(u){var c=f[u.x];c[u.y]||(c[u.y]=[]),c[u.y].push({x:e,y:n,creature:u.creature})}else i(t)}}function u(t,e){r.each(t,function(t,n){a(t,e,n)})}function c(t,e,n){if(t){var o=t.splice(r.random(t.length-1),1)[0],a=o.creature;a.successFn()===!1&&(l[o.x][o.y]=!1),a.boundEnergy(),l[e][n]=a,r.each(t,i)}}function s(t,e){r.each(t,function(t,n){c(t,e,n)})}var l,f,p=this.width,h=this.height,y=this.grid;for("number"!=typeof t&&(t=1);t--;)y=l?r.clone(l):this.grid,l=r.map(y,n),f=[],this.populate(!1,f),r.each(l,u),r.each(f,s);return l},n.prototype.draw=function(){i(this.canvas,this.grid,this.cellSize)},e.exports=n},{"./creature.js":2,"./display.js":3,"./dom.js":4,"./util":6}],6:[function(t,e){t("../bower_components/seedrandom/seedrandom.js")("terra",{global:!0});var n=t("../lodash_custom/lodash.custom.min.js")._;n.getNeighborCoords=function(t,e,n,r,o){var i,a,u,c,s=[];("number"!=typeof o||1>o)&&(o=1),i=Math.max(0,t-o),u=Math.max(0,e-o),a=Math.min(t+o,n),c=Math.min(e+o,r);for(var l=i;a>=l;l++)for(var f=u;c>=f;f++)(l!==t||f!==e)&&s.push({x:l,y:f});return s},e.exports=n},{"../bower_components/seedrandom/seedrandom.js":7,"../lodash_custom/lodash.custom.min.js":11}],7:[function(t,e){!function(t,e,n,r,o,i,a,u,c){function s(t){var e,n=t.length,o=this,i=0,a=o.i=o.j=0,u=o.S=[];for(n||(t=[n++]);r>i;)u[i]=i++;for(i=0;r>i;i++)u[i]=u[a=m&a+t[i%n]+(e=u[i])],u[a]=e;(o.g=function(t){for(var e,n=0,i=o.i,a=o.j,u=o.S;t--;)e=u[i=m&i+1],n=n*r+u[m&(u[i]=u[a=m&a+e])+(u[a]=e)];return o.i=i,o.j=a,n})(r)}function l(t,e){var n,r=[],o=typeof t;if(e&&"object"==o)for(n in t)try{r.push(l(t[n],e-1))}catch(i){}return r.length?r:"string"==o?t:t+"\x00"}function f(t,e){for(var n,r=t+"",o=0;ot;)t=(t+n)*r,e*=r,n=v.g(1);for(;t>=g;)t/=2,e/=2,n>>>=1;return(t+n)/e},m,"global"in i?i.global:this==n)};f(n[c](),e),a&&a.exports?a.exports=v:u&&u.amd&&u(function(){return v})}(this,[],Math,256,6,52,"object"==typeof e&&e,"function"==typeof define&&define,"random")},{}],8:[function(){Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this;return fNOP=function(){},fBound=function(){return n.apply(this instanceof fNOP&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))},fNOP.prototype=this.prototype,fBound.prototype=new fNOP,fBound})},{}],9:[function(t,e,n){!function(t,r){"function"==typeof define&&define.amd?define("smoothScroll",r(t)):"object"==typeof n?e.exports=r(t):t.smoothScroll=r(t)}(this,function(t){"use strict";var e,n={},r=!!document.querySelector&&!!t.addEventListener,o={speed:500,easing:"easeInOutCubic",offset:0,updateURL:!0,callbackBefore:function(){},callbackAfter:function(){}},i=function(t,e,n){if("[object Object]"===Object.prototype.toString.call(t))for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(n,t[r],r,t);else for(var o=0,i=t.length;i>o;o++)e.call(n,t[o],o,t)},a=function(t,e){var n={};return i(t,function(e,r){n[r]=t[r]}),i(e,function(t,r){n[r]=e[r]}),n},u=function(t){for(var e,n=String(t),r=n.length,o=-1,i="",a=n.charCodeAt(0);++o=1&&31>=e||127==e||0===o&&e>=48&&57>=e||1===o&&e>=48&&57>=e&&45===a?"\\"+e.toString(16)+" ":e>=128||45===e||95===e||e>=48&&57>=e||e>=65&&90>=e||e>=97&&122>=e?n.charAt(o):"\\"+n.charAt(o)}return i},c=function(t,e){var n;return"easeInQuad"===t&&(n=e*e),"easeOutQuad"===t&&(n=e*(2-e)),"easeInOutQuad"===t&&(n=.5>e?2*e*e:-1+(4-2*e)*e),"easeInCubic"===t&&(n=e*e*e),"easeOutCubic"===t&&(n=--e*e*e+1),"easeInOutCubic"===t&&(n=.5>e?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1),"easeInQuart"===t&&(n=e*e*e*e),"easeOutQuart"===t&&(n=1- --e*e*e*e),"easeInOutQuart"===t&&(n=.5>e?8*e*e*e*e:1-8*--e*e*e*e),"easeInQuint"===t&&(n=e*e*e*e*e),"easeOutQuint"===t&&(n=1+--e*e*e*e*e),"easeInOutQuint"===t&&(n=.5>e?16*e*e*e*e*e:1+16*--e*e*e*e*e),n||e},s=function(t,e,n){var r=0;if(t.offsetParent)do r+=t.offsetTop,t=t.offsetParent;while(t);return r=r-e-n,r>=0?r:0},l=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},f=function(t){return t&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(t):{}},p=function(t,e){history.pushState&&(e||"true"===e)&&history.pushState({pos:t.id},"",window.location.pathname+t)};return n.animateScroll=function(e,n,r,i){var h=a(h||o,r||{}),y=f(e?e.getAttribute("data-options"):null);h=a(h,y),n="#"+u(n.substr(1));var d,g,m,v=document.querySelector("[data-scroll-header]"),b=null===v?0:v.offsetHeight+v.offsetTop,j=t.pageYOffset,w=s(document.querySelector(n),b,parseInt(h.offset,10)),x=w-j,E=l(),O=0;e&&"a"===e.tagName.toLowerCase()&&i&&i.preventDefault(),p(n,h.updateURL);var S=function(r,o,i){var a=t.pageYOffset;(r==o||a==o||t.innerHeight+a>=E)&&(clearInterval(i),h.callbackAfter(e,n))},_=function(){O+=16,g=O/parseInt(h.speed,10),g=g>1?1:g,m=j+x*c(h.easing,g),t.scrollTo(0,Math.floor(m)),S(m,w,d)},C=function(){h.callbackBefore(e,n),d=setInterval(_,16)};0===t.pageYOffset&&t.scrollTo(0,0),C()},n.init=function(t){if(r){e=a(o,t||{});var u=document.querySelectorAll("[data-scroll]");i(u,function(t){t.addEventListener("click",n.animateScroll.bind(null,t,t.hash,e),!1)})}},n})},{}],10:[function(t){var e=t("../../app/creature.js"),n=t("../../app/util.js");e.register({type:"plant",color:[0,120,0],size:10,initialEnergy:5,maxEnergy:20,wait:function(){this.energy+=1},move:!1,reproduceLv:.65}),e.register({type:"wimp",color:[0,255,255],size:20,maxEnergy:50,initialEnergy:10}),e.register({type:"bully",color:[255,200,0],size:30,maxEnergy:50,initialEnergy:10,reproduceLv:.6,moveLv:0,metabolism:1,sustainability:3}),e.register({type:"GoL",color:[255,193,7],colorFn:function(){return this.alive?this.color+",1":"0,0,0,0"},wait:function(){},isDead:function(){return!1},queue:function(t){var e=n.filter(t,function(t){return t.creature.alive}).length;return this.alive=3===e||2===e&&this.alive,!1}},function(){this.alive=Math.random()<.5}),e.register({type:"cyclic",color:[0,0,0],colors:["255,0,0,1","255,217,0,1","72,255,0,1","0,255,145,1","0,145,255,1","72,0,255,1","255,0,217,1"],colorFn:function(){return this.colors[this.state]},wait:function(){},isDead:function(){return!1},queue:function(t){var e=(this.state+1)%7,r=n.some(t,function(t){return t.creature.state===e});r&&(this.state=e)}},function(){this.state=Math.floor(7*Math.random())})},{"../../app/creature.js":2,"../../app/util.js":6}],11:[function(t,e,n){(function(t){(function(){function r(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function o(t){t.length=0,A.lengthn?0:n);++rk;k++)r+="n='"+n.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",n.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+n.g+"}";r+="}"}return(n.b||je.nonEnumArgs)&&(r+="}"),r+=n.c+";return E",t("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",e+r+"}")(l,z,ee,ce,I,g,xe,b,K.f,ne,Y,be,J,re,oe)}function d(t){return"function"==typeof t&&ie.test(t)}function g(t){return t&&"object"==typeof t&&"number"==typeof t.length&&oe.call(t)==M||!1}function m(t){return"function"==typeof t}function v(t){return!(!t||!Y[typeof t])}function b(t){return"string"==typeof t||t&&"object"==typeof t&&oe.call(t)==J||!1}function j(t,e,n){var r=[];if(e=a.createCallback(e,n,3),xe(t)){n=-1;for(var o=t.length;++narguments.length;if(e=a.createCallback(e,r,4),xe(t)){var i=-1,u=t.length;for(o&&(n=t[++i]);++i3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),Fe=y(Z,Se,{j:!1}),Ae=y(Z,Se);m(/x/)&&(m=function(t){return"function"==typeof t&&"[object Function]"==oe.call(t)}),a.assign=Ce,a.bind=S,a.createCallback=function(t,e,n){var r=typeof t;if(null==t||"function"==r)return l(t,e,n);if("object"!=r)return F(t);var o=Oe(t),i=o[0],a=t[i];return 1!=o.length||a!==a||v(a)?function(e){for(var n=o.length,r=!1;n--&&(r=p(e[o[n]],t[o[n]],null,!0)););return r}:function(t){return t=t[i],a===t&&(0!==a||1/a==1/t)}},a.filter=j,a.forEach=w,a.forIn=Fe,a.forOwn=Ae,a.keys=Oe,a.map=x,a.property=F,a.collect=x,a.each=w,a.extend=Ce,a.select=j,a.clone=function(t,e,n,r){return"boolean"!=typeof e&&null!=e&&(r=n,n=e,e=!1),c(t,e,"function"==typeof n&&l(n,r,1))},a.identity=_,a.isArguments=g,a.isArray=xe,a.isFunction=m,a.isObject=v,a.isString=b,a.noop=C,a.random=function(t,e,n){var r=null==t,o=null==e;return null==n&&("boolean"==typeof t&&o?(n=t,t=1):o||"boolean"!=typeof e||(n=e,o=!0)),r&&o&&(e=1),t=+t||0,o?(e=t,t=0):e=+e||0,n||t%1||e%1?(n=me(),ge(t+n*(e-t+parseFloat("1e-"+((n+"").length-1))),e)):t+ae(me()*(e-t+1))},a.reduce=E,a.some=O,a.any=O,a.foldl=E,a.inject=E,a.VERSION="2.4.1",W&&X&&(W._=a)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);