*If I'm infected then individuals I randomly encounter may become
infected. The odds of encountering anyone is heavily biased to those nearby.*

Begin micro-behaviour
**RANDOM-SPATIAL-ENCOUNTER**

Begin NetLogo code:
substitute-text-area-for odds-of-encountering 1 / (1 + distance-to-me ^ 2) > random-number-between 0 1
do-every 1
[do-if my-state = "infected"
[do-for-n the-encounter-rate
all-individuals with
[my-state != "dead" and
odds-of-encountering]
[set my-last-encounter the-other
add-behaviours list-of-micro-behaviours "Encounter Behaviours" [POSSIBLE-INFECTION.html]]]]

End NetLogo code
## Variants

A different formula for biasing the odds to nearby
individuals can be used. Additional encounter behaviours can be added.

## Related Micro-behaviours

This relies upon the
POSSIBLE-INFECTION micro-behaviour to possibly infect the other.
CREATE-ENCOUNTER-RATE-SLIDER defines *the-encounter-rate* variable
used here.

RANDOM-ENCOUNTER is like this micro-behaviour without a spatial bias.

RANDOM-SOCIAL-ENCOUNTER chooses individuals among my set of
acquaintances.

RANDOM-PHYSICAL-ENCOUNTER chooses individuals that are at my location.

## How this works

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 (who are not dead) . Individuals are picked
with a probability that is inversely proportional to the square of the
distance to me. I give these individuals the micro-behaviour
POSSIBLE-INFECTION. The formula adds 1 to avoid a division by zero if
someone is co-located with me. 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.

## History

This was implemented by Ken Kahn.