Improved brain mutation

This commit is contained in:
MaxRobinsonTheGreat
2020-08-31 10:12:19 -06:00
parent 80ed33113c
commit 22436f6b33
3 changed files with 14 additions and 16 deletions

2
dist/js/bundle.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +0,0 @@
{
"hello": "world"
}

View File

@@ -160,6 +160,17 @@ class Organism {
}
}
if (Math.random() * 100 <= prob) {
if (org.is_mover && Math.random() * 100 <= 10) {
if (org.has_eyes) {
org.brain.mutate();
}
org.move_range += Math.floor(Math.random() * 4) - 2;
if (org.move_range <= 0){
org.move_range = 1;
};
}
else
org.mutate();
}
@@ -216,16 +227,6 @@ class Organism {
mutated = this.removeCell(cell.loc_col, cell.loc_row);
}
}
if (this.is_mover && Math.random() * 100 <= 10) {
this.move_range += Math.floor(Math.random() * 4) - 2;
if (this.move_range <= 0){
this.move_range = 1;
};
}
if (this.is_mover && this.has_eyes && Math.random() * 100 <= 10) {
this.brain.mutate();
}
return mutated;
}