cleaned chart code/added cells chart

This commit is contained in:
Max Robinson
2021-02-11 13:24:42 -07:00
parent 7b19798be9
commit 9626cd54d6
12 changed files with 137 additions and 51 deletions

View File

@@ -22,6 +22,7 @@ class WorldEnvironment extends Environment{
this.largest_cell_count = 0;
this.reset_count = 0;
this.total_ticks = 0;
this.total_cells = 0;
this.data_update_rate = 100;
FossilRecord.setEnv(this);
}
@@ -52,6 +53,7 @@ class WorldEnvironment extends Environment{
removeOrganisms(org_indeces) {
for (var i of org_indeces.reverse()){
this.total_mutability -= this.organisms[i].mutability;
this.total_cells -= this.organisms[i].anatomy.cells.length;
this.organisms.splice(i, 1);
}
if (this.organisms.length == 0 && this.auto_reset){
@@ -76,6 +78,7 @@ class WorldEnvironment extends Environment{
this.organisms.push(organism);
if (organism.anatomy.cells.length > this.largest_cell_count)
this.largest_cell_count = organism.anatomy.cells.length;
this.total_cells += organism.anatomy.cells.length;
}
averageMutability() {
@@ -122,12 +125,13 @@ class WorldEnvironment extends Environment{
}
}
reset(clear_walls=true) {
reset() {
this.organisms = [];
this.grid_map.fillGrid(CellStates.empty);
this.renderer.renderFullGrid(this.grid_map.grid);
this.total_mutability = 0;
this.total_ticks = 0;
this.total_cells = 0;
FossilRecord.clear_record();
this.OriginOfLife();
}