Permalink
Browse files

embiggen canvas, fix exodus distance

  • Loading branch information...
1 parent de8c0e8 commit 9ae7ea288425f71ec97e1999acf20d01c6d85720 @clawtros clawtros committed May 9, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 sim.html
  2. +2 −2 sim.js
View
@@ -13,7 +13,7 @@
sim = new Simulator({
canvas: 'canvas',
height: 500,
- width: 500,
+ width: 800,
num_pops: 25,
});
sim.start();
View
@@ -37,7 +37,7 @@ Color.prototype.average = function(c) {
}
Color.prototype.as_rgba = function() {
- return "rgba("+Math.round(this.r)+","+Math.round(this.g)+","+Math.round(this.b)+",0.8)";//+this.a+")";
+ return "rgba("+Math.round(this.r)+","+Math.round(this.g)+","+Math.round(this.b)+",0.5)";//+this.a+")";
}
Color.prototype.mul = function(amount) {
@@ -108,7 +108,7 @@ Population.prototype.interact_with = function(other, dt) {
var dy = this.y-other.y;
var distance = (Math.sqrt(dx*dx + dy*dy)) / this.max_dist;
- if (this.compatibility(other) > (this.opts.error * (Math.random() + 0.5)) * (1-distance)) {
+ if (this.compatibility(other) > (this.opts.error * (Math.random() + 0.5)) * (distance)) {
var exodus = 0.05*Math.random()*this.size;
this.size -= exodus;
other.size += exodus;

0 comments on commit 9ae7ea2

Please sign in to comment.