-
Notifications
You must be signed in to change notification settings - Fork 124
Adjust the reproduction cost of each cell individually by clicking the colors in the About tab! #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Adjust the reproduction cost of each cell individually by clicking the colors in the About tab! #107
Changes from all commits
ac4d17a
6c0d3a3
ca4a940
5b0ba20
bd8651c
0755792
07ca949
7a88d6c
cef45ef
75760ee
aa1f19e
7525bc8
b430275
4e6a9cb
e7a9815
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,7 @@ class Organism { | |
|
|
||
| // amount of food required before it can reproduce | ||
| foodNeeded() { | ||
| return this.anatomy.is_mover ? this.anatomy.cells.length + Hyperparams.extraMoverFoodCost : this.anatomy.cells.length; | ||
| return this.anatomy.getTotalCost(); | ||
| } | ||
|
|
||
| lifespan() { | ||
|
|
@@ -261,7 +261,11 @@ class Organism { | |
| for (var cell of this.anatomy.cells) { | ||
| var real_c = this.c + cell.rotatedCol(this.rotation); | ||
| var real_r = this.r + cell.rotatedRow(this.rotation); | ||
| this.env.changeCell(real_c, real_r, CellStates.food, null); | ||
| if(Hyperparams.cost[cell.state.name] > 0.001) { | ||
| this.env.changeCell(real_c, real_r, CellStates.food, {food_value: Hyperparams.cost[cell.state.name]}); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMPORTANT BUG FIX: For example, when the cost of a cell is 0.35 (below 1), the organism spends 0.35 to reproduce that cell, but when that cell dies, it gives 1 food at position. This means 0.65 food that exist out of nothing in the system. To correct this gap, the food cell was given a food_value that was equal to the cost of the cell. |
||
| }else{ | ||
| this.env.changeCell(real_c, real_r, CellStates.empty, null); | ||
| } | ||
| } | ||
| this.species.decreasePop(); | ||
| this.living = false; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Massive performance difference. Now It has almost no effect on performance!