😌 make sure to use constants...

This commit is contained in:
Felix Pankratz 2024-12-15 14:53:30 +01:00
parent a0bca54bb1
commit de5c0a5e1c

View File

@ -37,10 +37,10 @@ std::vector<SlimeAgent> agents;
void init_attractant() { void init_attractant() {
memset(attractant, 0.0, sizeof attractant); memset(attractant, 0.0, sizeof attractant);
// draw a circle out of attractant // draw a circle out of attractant
//for (int p = 0; p < 64; p++) { //for (int p = 0; p < PANEL_WIDTH; p++) {
// float angle = ((PI * 2) / 64) * p; // float angle = ((PI * 2) / PANEL_WIDTH) * p;
// int x = 31 + round(10 * sin(angle)); // int x = PANEL_WIDTH/2 + round(10 * sin(angle));
// int y = 15 + round(10 * cos(angle)); // int y = PANEL_WIDTH/2 + round(10 * cos(angle));
// attractant[x][y] = 15.0; // attractant[x][y] = 15.0;
//} //}
@ -56,16 +56,16 @@ void init_attractant() {
} }
void init_agents() { void init_agents() {
AGENT_MOVE_DISTANCE = 1; //random(1, 3); AGENT_MOVE_DISTANCE = 1;
AGENT_MOVE_ANGLE = 0.175;//random(0, 334) / 1000.0; AGENT_MOVE_ANGLE = 0.175;//random(0, 334) / 1000.0;
//if (random(0, 2) > 0) { //if (random(0, 2) > 0) {
// AGENT_SENSOR_ANGLE = 0.175; // AGENT_SENSOR_ANGLE = 0.175;
//} else { //} else {
AGENT_SENSOR_ANGLE = 0.0875; AGENT_SENSOR_ANGLE = 0.0875;
//} //}
AGENT_SENSOR_DISTANCE = random(AGENT_SENSOR_DISTANCE_MIN * 1000.0, AGENT_SENSOR_DISTANCE_MAX * 1000.0) / 1000.0; AGENT_SENSOR_DISTANCE = random(AGENT_SENSOR_DISTANCE_MIN * 1000.0, AGENT_SENSOR_DISTANCE_MAX * 1000.0) / 1000.0;
NUM_AGENTS = random(NUM_AGENTS_MIN, NUM_AGENTS_MAX); NUM_AGENTS = random(NUM_AGENTS_MIN, NUM_AGENTS_MAX);
agents.clear(); agents.clear();
for(int a = 0; a < NUM_AGENTS; a++) { for(int a = 0; a < NUM_AGENTS; a++) {
float angle = ((PI * 2) / NUM_AGENTS) * a; float angle = ((PI * 2) / NUM_AGENTS) * a;