diff --git a/organism/src/main.cpp b/organism/src/main.cpp index d3bcf81..107f61b 100644 --- a/organism/src/main.cpp +++ b/organism/src/main.cpp @@ -80,7 +80,8 @@ void init_agents() { AGENT_MOVE_DISTANCE = 1; //random(1, 3); AGENT_MOVE_ANGLE = random(0, 334) / 1000.0; AGENT_SENSOR_ANGLE = random(0, 334) / 1000.0; - AGENT_SENSOR_DISTANCE = random(100, 400) / 1000.0; + //AGENT_SENSOR_DISTANCE = random(100, 400) / 1000.0; + AGENT_SENSOR_DISTANCE = random(3000, 5000) / 1000.0; for(int a = 0; a < NUM_AGENTS; a++) { float angle = ((PI * 2) / NUM_AGENTS) * a; //agents[a].x_position = 31 + round(10*sin(angle)); @@ -290,7 +291,10 @@ void loop() { } else { agents[a].heading += (random(-1,2) *2 - 1 ) * 30 / 100.0 * PI*2; } - // sample step + } + // sample step + for(int a = 0; a < NUM_AGENTS; a++) { + //matrix->drawPixel(agents[a].x_position, agents[a].y_position, matrix->color565(0, 0, attractant[agents[a].x_position][agents[a].y_position])); int front_x = round(agents[a].x_position + cos(agents[a].heading) * AGENT_SENSOR_DISTANCE); int front_y = round(agents[a].y_position + sin(agents[a].heading) * AGENT_SENSOR_DISTANCE); int left_x = round(agents[a].x_position + cos(agents[a].heading - (AGENT_SENSOR_ANGLE * (PI * 2))) * AGENT_SENSOR_DISTANCE);