More hyperparameters!
This commit is contained in:
@@ -96,6 +96,31 @@ class ControlPanel {
|
||||
Hyperparams.lifespanMultiplier = lifespan;
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
$('#mover-rot').change(function() {
|
||||
Hyperparams.moversCanRotate = this.checked;
|
||||
});
|
||||
$('#offspring-rot').change(function() {
|
||||
Hyperparams.offspringRotate = this.checked;
|
||||
});
|
||||
$('#insta-kill').change(function() {
|
||||
Hyperparams.instaKill = this.checked;
|
||||
});
|
||||
|
||||
$('#evolved-mutation').change( function() {
|
||||
if (this.checked) {
|
||||
$('.global-mutation-in').css('display', 'none');
|
||||
$('#avg-mut').css('display', 'block');
|
||||
}
|
||||
else {
|
||||
$('.global-mutation-in').css('display', 'block');
|
||||
$('#avg-mut').css('display', 'none');
|
||||
}
|
||||
Hyperparams.useGlobalMutability = !this.checked;
|
||||
});
|
||||
$('#global-mutation').change( function() {
|
||||
Hyperparams.globalMutability = $('#global-mutation').val();
|
||||
});
|
||||
$('.mut-prob').change( function() {
|
||||
switch(this.id){
|
||||
case "add-prob":
|
||||
@@ -115,15 +140,11 @@ class ControlPanel {
|
||||
$('#change-prob').val(Math.floor(Hyperparams.changeProb));
|
||||
$('#remove-prob').val(Math.floor(Hyperparams.removeProb));
|
||||
});
|
||||
|
||||
$('#mover-rot').change(function() {
|
||||
Hyperparams.moversCanRotate = this.checked;
|
||||
$('#movers-produce').change( function() {
|
||||
Hyperparams.moversCanProduce = this.checked;
|
||||
});
|
||||
$('#offspring-rot').change(function() {
|
||||
Hyperparams.offspringRotate = this.checked;
|
||||
});
|
||||
$('#insta-kill').change(function() {
|
||||
Hyperparams.instaKill = this.checked;
|
||||
$('#food-blocks').change( function() {
|
||||
Hyperparams.foodBlocksReproduction = this.checked;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,14 @@ class EnvironmentController extends CanvasController{
|
||||
}
|
||||
}
|
||||
|
||||
dropWall(cell) {
|
||||
|
||||
}
|
||||
|
||||
dropFood(cell) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const Hyperparams = {
|
||||
growableNeighbors: Neighbors.adjacent,
|
||||
|
||||
useGlobalMutability: false,
|
||||
globalMutability: 0,
|
||||
globalMutability: 5,
|
||||
|
||||
addProb: 33,
|
||||
changeProb: 33,
|
||||
@@ -18,6 +18,9 @@ const Hyperparams = {
|
||||
moversCanRotate: true,
|
||||
offspringRotate: true,
|
||||
|
||||
foodBlocksReproduction: true,
|
||||
moversCanProduce: false,
|
||||
|
||||
instaKill: false,
|
||||
|
||||
// calculates the optimal ratio where a producer cell is most likely to produce 1 food in its lifespan * a scalar of my choice :)
|
||||
|
||||
@@ -58,7 +58,7 @@ function eatNeighborFood(self, n_cell, env){
|
||||
}
|
||||
|
||||
function growFood(self, env){
|
||||
if (self.owner.is_mover)
|
||||
if (self.owner.is_mover && !Hyperparams.moversCanProduce)
|
||||
return;
|
||||
var prob = Hyperparams.foodProdProb;
|
||||
if (Math.random() * 100 <= prob){
|
||||
|
||||
@@ -134,13 +134,11 @@ class Organism {
|
||||
var direction = Directions.getRandomScalar();
|
||||
var direction_c = direction[0];
|
||||
var direction_r = direction[1];
|
||||
var offset = (Math.floor(Math.random() * 2)) * 2;
|
||||
var offset = (Math.floor(Math.random() * 3)) * 1;
|
||||
var basemovement = (Math.min(2+this.cells.length, 15));
|
||||
var new_c = this.c + (direction_c*basemovement) + (direction_c*offset);
|
||||
var new_r = this.r + (direction_r*basemovement) + (direction_r*offset);
|
||||
|
||||
var new_c = this.c + (direction_c*Math.min(this.cells.length*2, 15)) + (direction_c*offset);
|
||||
var new_r = this.r + (direction_r*Math.min(this.cells.length*2, 15)) + (direction_r*offset);
|
||||
|
||||
// var new_c = Math.min(this.cells.length*2, 10);
|
||||
// var new_r = Math.min(this.cells.length*2, 10);
|
||||
if (org.isClear(new_c, new_r) && org.isStraightPath(new_c, new_r, this.c, this.r, this)){
|
||||
org.c = new_c;
|
||||
org.r = new_r;
|
||||
@@ -149,8 +147,6 @@ class Organism {
|
||||
}
|
||||
|
||||
this.food_collected -= this.foodNeeded();
|
||||
|
||||
|
||||
}
|
||||
|
||||
mutate() {
|
||||
@@ -271,9 +267,13 @@ class Organism {
|
||||
isClear(col, row, rotation=this.rotation) {
|
||||
for(var loccell of this.cells) {
|
||||
var cell = this.getRealCell(loccell, col, row, rotation);
|
||||
if(cell == null || cell.type != CellTypes.empty && cell.owner != this) {
|
||||
if(cell==null) {
|
||||
return false;
|
||||
}
|
||||
if (cell.owner==this || cell.type==CellTypes.empty || (!Hyperparams.foodBlocksReproduction && cell.type==CellTypes.food)){
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user