Set target_2 calc_target neighbor_2 distance_2 the headings and positions of each neighbor Set target_1 calc_target neighbor_1 distance_1 calculates targets (see procedure below) based on Set acceleration 0 sets acceleration to zero Repeat count group-members repeat the next step as many times as there are group members (foreach (sort group-members) (n-values count group-members ) [ set each turtle in my agentset (group) with an ID no. Set group-members turtle-set turtles with of myself] set those sharing a group id as my group-members Set id-within-group 0 initializes variables used in finding neighbors [ifelse not ((i = who) or in_blind_spot? or behind_opaque_obstacle?) ![]() variables are then re-assigned to accomodate the new neighbor as one of the closest three. it is then compared with neighbor_2 and (if it's closer than neighbor_2) with neighbor_1 its distance is compared with that of neighbor_3. first checked to be visible (i.e., out of blind spot and in front of obstacles), and then (below) determines ID numbers and distances for three closest neighbors each turtle is Set i 0 initializes variables used in finding neighbors
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |