Created
October 27, 2017 15:17
-
-
Save fedden/03e4be43b62991c1fe26447f19403f6b to your computer and use it in GitHub Desktop.
diffusion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (auto& agent : unhappy_agents) | |
| { | |
| if (happy_agents.size() > 0) | |
| { | |
| size_t random_index = uniform_random.get_next(agent_size - 1); | |
| if (agents[random_index]->happy) | |
| { | |
| set_agent_randomly_in_same_quadrant(agents[random_index], | |
| agent, | |
| agents, | |
| partial_grid, | |
| partial_size, | |
| grid_size, | |
| uniform_random); | |
| } | |
| else | |
| { | |
| agent->x = uniform_random.get_next(grid_size - 1); | |
| agent->y = uniform_random.get_next(grid_size - 1); | |
| } | |
| } | |
| else | |
| { | |
| agent->x = uniform_random.get_next(grid_size - 1); | |
| agent->y = uniform_random.get_next(grid_size - 1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment