davis= { random:function (x){return (Math.floor(Math.random()*x));}, bell: function (x) { var i=Math.round((davis.random(x)+davis.random(x)+davis.random(x))/3); return i; }, randomColor:function (x,full){ if (x){ x=x.toLowerCase();} else{x=="none"} if (!full){var full=false;} var red=davis.random(255); var green=davis.random(255); var blue=davis.random(255); if (x=="grey" || x=="gray" || x=="fullgrey" || x=="fullgray"){ blue=red; green=red; } if (x=='warm' || x=='hot'){ red=200+davis.random(55); blue=davis.random(30); } if (x=='cool' || x=='cold'){ blue=100+davis.random(155); red=davis.random(50); } if (x=="mammal" || x=="mammalian"){ red=160+davis.random(85); green=red-40; blue=green/2; } var color="rgb("+red+","+green+","+blue+")"; if (full==true){ var text="#eee"; var alpha0="rgba("+red+","+green+","+blue+",0)"; var alpha1="rgba("+red+","+green+","+blue+",1)"; if ((red+green+blue)>400){text="#111";} return {red:red,green:green,blue:blue,rgb:color,text:text,alpha0:alpha0,alpha1:alpha1}; } else{ return color; } }, alpha:function(colorString,number){ colorString=colorString.replace(/rgb/,"rgba"); colorString=colorString.replace(/[)]/,(","+number+")")); return colorString; }, randomWord:function(x){ if (!x){x=1;} var vo=["a","e","i","o","u"]; var con=["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"]; var phrase=[]; for (var j=0;j2){ word+=davis.pick(con); } phrase.push(word); } word=phrase.join(" "); return word; }, pick: function (x) {return x[davis.random(x.length)];}, sumTo:function(x){ if (!x){return false;} var y=[]; while (x>0){ var redux=1+davis.random(x); y.push(redux); x=x-redux; } return y; }, mutate:function(x,p){ var p=p || 10; p=p*0.01*x; var x=x-(p)+davis.random(2*p); return x; }, //this takes two arrays - one the source of new material, the other saved material from the past, and decides which to return an element from, then selects a random element from the ancestral or mutational array. darwin:function(mutation,ancestry) { var anar=ancestry.length; var m=(9*anar*anar)/((anar*anar)+100); var d=1+this.random(10); if (m>d){ return this.pick(ancestry);} else{ return this.pick(mutation);} }, style:function(selector,values){ if (!jQuery){return false}; if ($("head style#dynamic").get().length==0){ $("head").append(""); } if (selector=="clear" || !selector){$("head style#dynamic").html("");} var s=selector+"{"; for (i in values){ s+=i+":"+values[i]+";"; } s+="}"; $("head style#dynamic").append(s); }, grid:function(xSteps,ySteps,bounds){ var grid=[]; var b=bounds; console.log(b); var xInterval=(bounds.right-bounds.left)/xSteps; var yInterval=(bounds.bottom-bounds.top)/ySteps; for (var i=0;i"; license+="

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to DEALINGS in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

"; license+="

The above copyright notice and this permission notice shall be included included all copies or substantial portions of the Software.

"; license+="

THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"; license+=""; return license; } };