Skip to content

Instantly share code, notes, and snippets.

@fedden
Created October 27, 2017 15:17
Show Gist options
  • Save fedden/b36e7d73e6d3f560755a423a714eeea3 to your computer and use it in GitHub Desktop.
Save fedden/b36e7d73e6d3f560755a423a714eeea3 to your computer and use it in GitHub Desktop.
test_phase
for (auto& agent : agents)
{
if (agent->set_happy(partial_grid))
{
happy_agents.push_back(agent);
const size_t hill_index = get_hill_index((*agent), partial_size, grid_size);
if (++most_frequent_hill_indices[hill_index] > max_indices)
{
max_indices = most_frequent_hill_indices[hill_index];
best_index = hill_index;
}
}
else
unhappy_agents.push_back(agent);
}
best_hill_coordinates = get_hill_position(best_index, partial_size, grid_size, draw_scalar);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment