Closed altivecer closed 2 years ago
Great catch! I'm testing it now and the results of that challenge are much better behaved. Thanks for finding and reporting this.
Hi David,
When I was trying to figure out what was wrong with the death check I added the following to simulator.cpp just before endOfGenerations(generation); It really helped and made watch a generation much more satisfying.
// kill any cell that is going to die execpt for the ALTRUISM cases becasue I'm note sure what to do there
int numAlive = p.population;
if (p.challenge != CHALLENGE_ALTRUISM && p.challenge != CHALLENGE_ALTRUISM_SACRIFICE)
{
for (uint16_t index = 1; index <= p.population; ++index)
{
std::pair<bool, float> passed = passedSurvivalCriterion(peeps[index], p.challenge);
if (!passed.first)
{
peeps[index].willDie=true;
--numAlive;
}
}
for (uint16_t index = 1; index <= p.population; ++index)
{
if (peeps[index].willDie)
{
peeps[index].alive=false;
grid.set(peeps[index].loc, 0);
}
}
}
// Save one final frame of video
endOfSimStep(p.stepsPerGeneration, generation);
Also updated Indic.h to add willDie
struct Indiv { bool alive; bool willDie;
And indiv.cpp to initialize willDie to false.
void Indiv::initialize(uint16t index, Coord loc, Genome &&genome) { index = index; loc = loc; //birthLoc = loc; grid.set(loc, index_); age = 0; oscPeriod = 34; // ToDo !!! define a constant alive = true; willDie = false;
Thanks, looks interesting.
In survival-criteria.cpp, in the case CHALLENGE_PAIRS there is a pair of for loops that have a bad check for the end of the loop
should be
same issue for the inner pair.
should be