I saw in a previous issue where these two assertions were added. I'm curious, however, if the program asserts that the direction is not CENTER, how do you prevent creatures from actually using that direction when these sensors are called?
|
assert(dir != Compass::CENTER); // require a defined axis |
|
assert(dir != Compass::CENTER); // require a defined axis |
In the getSensor() call I would imagine that the creatures would have a last move direction as CENTER just by chance.
|
sensorVal = getPopulationDensityAlongAxis(loc, lastMoveDir); |
In my implementation in Java, these assertions are preventing the program from moving forward so I changed them to early returns where the method just returns 0.5 if the direction supplied is CENTER. But I am not sure if that is the right interpretation.
Would love some insight.
I saw in a previous issue where these two assertions were added. I'm curious, however, if the program asserts that the direction is not CENTER, how do you prevent creatures from actually using that direction when these sensors are called?
biosim4/src/getSensor.cpp
Line 22 in 33d6832
biosim4/src/getSensor.cpp
Line 120 in 33d6832
In the getSensor() call I would imagine that the creatures would have a last move direction as CENTER just by chance.
biosim4/src/getSensor.cpp
Line 311 in 33d6832
In my implementation in Java, these assertions are preventing the program from moving forward so I changed them to early returns where the method just returns 0.5 if the direction supplied is CENTER. But I am not sure if that is the right interpretation.
Would love some insight.