RANDOM-PHYSICAL-ENCOUNTERBegin NetLogo code:
do-every 1 [do-if my-state = "infected" [do-for-n the-encounter-rate other-objects-here [set my-last-encounter the-other add-behaviours list-of-micro-behaviours "Encounter Behaviours" [POSSIBLE-INFECTION.html]]]]End NetLogo code
Note that if there are fewer than the-encounter-rate individuals at my location then only those are possibly infected.
Additional encounter behaviours can be added.
This relies upon the POSSIBLE-INFECTION micro-behaviour to possibly infect the other. CREATE-ENCOUNTER-RATE-SLIDER defines the the-encounter-rate variable used here.
The doesn't make much sense unless the agents move around. WANDER-RANDOMLY-IN-COMPASS-DIRECTIONS and WANDER-RANDOMLY-BY-TURNING can be used to cause them to move. If you use WANDER-RANDOMLY-BY-TURNING you probably should start them off facing in different directions by adding SET-RANDOM-HEADING to add-copies so each copy starts off with a different heading.
RANDOM-SPATIAL-ENCOUNTER differs from this micro-behaviour in biasing the selection of the other individual to those close by.
RANDOM-SOCIAL-ENCOUNTER selects among my acquaintances.
RANDOM-ENCOUNTER selects any individual.
This models individuals that have the-encounter-rate encounters per unit time period (e.g., a simulated week). Every second, if I'm still infected (i.e., my-state = "infected") then I pick the-encounter-rate other individuals at my patch of land (who are not dead) and give them the micro-behaviour POSSIBLE-INFECTION. If the-encounter-rate is a non-integer then the remainder is compared with a random number probabilistically to possibly include one additional individual. I also sets the my-last-encounter variable of the other individuals to me in order to keep track of how many infections I cause.
do-for-n selects n agents and sets the-other to refer to each one.
This was implemented by Ken Kahn.