Two code changes in lines 354-357 and on line 368. The second change fixes #20.
As per the comment for case GENETIC_SIM_FWD
case Sensor::GENETIC_SIM_FWD:
{
// Return minimum sensor value if nobody is alive in the forward adjacent location,
// else returns a similarity match in the sensor range 0.0..1.0
Coord loc2 = loc + lastMoveDir;
if (grid.isInBounds(loc2) && grid.isOccupiedAt(loc2))
{
const Indiv &indiv2 = peeps.getIndiv(loc2);
if (indiv2.alive)
{
an else condition is added to ensure sensorVal = 0.0 // minimum if indiv2.alive == false.
The other code change is an oddity - perhaps simply the way C++ handles types...
Changing the following console output type for sensorVal from int to float eliminates the error output reported in issue #20:
There are a lot of "changes"marked in red, below. My dev app VS Code automatically changed the entire file's indentation. If this is not acceptable then I can turn off this VS Code behavior and create a new PR.
Two code changes in lines 354-357 and on line 368. The second change fixes #20.
As per the comment for case GENETIC_SIM_FWD
an else condition is added to ensure
sensorVal = 0.0 // minimum
ifindiv2.alive == false
.The other code change is an oddity - perhaps simply the way C++ handles types... Changing the following console output type for
sensorVal
fromint
tofloat
eliminates the error output reported in issue #20:There are a lot of "changes"marked in red, below. My dev app VS Code automatically changed the entire file's indentation. If this is not acceptable then I can turn off this VS Code behavior and create a new PR.