Added various control panel options

This commit is contained in:
MaxRobinsonTheGreat
2020-07-09 20:32:25 -06:00
parent c6b0a5bafc
commit 949d46e7c4
10 changed files with 196 additions and 58 deletions

24
src/Hyperparameters.js Normal file
View File

@@ -0,0 +1,24 @@
const Neighbors = require("./Neighbors");
var Hyperparams = {
lifespanMultiplier: 100,
foodProdProb: 1,
killableNeighbors: Neighbors.adjacent,
edibleNeighbors: Neighbors.adjacent,
growableNeighbors: Neighbors.adjacent,
// calculates the optimal ratio where a producer cell is most likely to produce 1 food in its lifespan.
calcProducerFoodRatio : function(lifespan_fixed=true) {
if (lifespan_fixed) {
// change the foodProdProb
this.foodProdProb = 100 / this.lifespanMultiplier;
}
else {
// change the lifespanMultiplier
this.lifespanMultiplier = Math.floor(100 / this.foodProdProb);
}
}
}
module.exports = Hyperparams;