fixed the birth distance issue
This commit is contained in:
2
dist/js/bundle.js
vendored
2
dist/js/bundle.js
vendored
File diff suppressed because one or more lines are too long
@@ -64,7 +64,7 @@ class EditorController extends CanvasController{
|
|||||||
|
|
||||||
defineEditorOptions() {
|
defineEditorOptions() {
|
||||||
$('#birth-distance').change ( function() {
|
$('#birth-distance').change ( function() {
|
||||||
this.env.organism.birth_distance = $('#birth-distance').val();
|
this.env.organism.birth_distance = parseInt($('#birth-distance').val());
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class WorldEnvironment extends Environment{
|
|||||||
|
|
||||||
addOrganism(organism) {
|
addOrganism(organism) {
|
||||||
organism.updateGrid();
|
organism.updateGrid();
|
||||||
|
console.log(organism.birth_distance);
|
||||||
this.total_mutability += organism.mutability;
|
this.total_mutability += organism.mutability;
|
||||||
this.organisms.push(organism);
|
this.organisms.push(organism);
|
||||||
if (organism.cells.length > this.largest_cell_count)
|
if (organism.cells.length > this.largest_cell_count)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class Organism {
|
|||||||
var direction_c = direction[0];
|
var direction_c = direction[0];
|
||||||
var direction_r = direction[1];
|
var direction_r = direction[1];
|
||||||
var offset = (Math.floor(Math.random() * 3));
|
var offset = (Math.floor(Math.random() * 3));
|
||||||
var basemovement = this.birth_distance;//Math.min(2+this.cells.length, 25);
|
var basemovement = this.birth_distance;
|
||||||
var new_c = this.c + (direction_c*basemovement) + (direction_c*offset);
|
var new_c = this.c + (direction_c*basemovement) + (direction_c*offset);
|
||||||
var new_r = this.r + (direction_r*basemovement) + (direction_r*offset);
|
var new_r = this.r + (direction_r*basemovement) + (direction_r*offset);
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ class Organism {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Math.random() * 100 <= 10) {
|
if (Math.random() * 100 <= 10) {
|
||||||
this.birth_distance += Math.floor(Math.random() * 4) - 2;
|
this.birth_distance += Math.floor(Math.random() * 3) - 1;
|
||||||
if (this.birth_distance < 1)
|
if (this.birth_distance < 1)
|
||||||
this.birth_distance = 1;
|
this.birth_distance = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user