Fixed up chart

This commit is contained in:
Max Robinson
2021-02-10 18:09:18 -07:00
parent 382794bf3f
commit 7b19798be9
14 changed files with 318 additions and 563 deletions

View File

@@ -22,11 +22,11 @@ class WorldEnvironment extends Environment{
this.largest_cell_count = 0;
this.reset_count = 0;
this.total_ticks = 0;
this.data_update_rate = 100;
FossilRecord.setEnv(this);
}
update(delta_time) {
this.total_ticks ++;
var to_remove = [];
for (var i in this.organisms) {
var org = this.organisms[i];
@@ -38,6 +38,10 @@ class WorldEnvironment extends Environment{
this.generateFood();
}
this.removeOrganisms(to_remove);
this.total_ticks ++;
if (this.total_ticks % this.data_update_rate == 0) {
FossilRecord.updateData();
}
}
render() {
@@ -77,6 +81,9 @@ class WorldEnvironment extends Environment{
averageMutability() {
if (this.organisms.length < 1)
return 0;
if (Hyperparams.useGlobalMutability) {
return Hyperparams.globalMutability;
}
return this.total_mutability / this.organisms.length;
}
@@ -129,7 +136,6 @@ class WorldEnvironment extends Environment{
this.renderer.cell_size = cell_size;
this.renderer.fillShape(rows*cell_size, cols*cell_size);
this.grid_map.resize(cols, rows, cell_size);
this.reset();
}
resizeFillWindow(cell_size) {
@@ -138,7 +144,6 @@ class WorldEnvironment extends Environment{
var cols = Math.floor(this.renderer.width / cell_size);
var rows = Math.floor(this.renderer.height / cell_size);
this.grid_map.resize(cols, rows, cell_size);
this.reset();
}
}