I may become infected depending upon whether I'm susceptible.

Begin micro-behaviour

POSSIBLE-INFECTION

Begin NetLogo code:
do-if my-state = "susceptible" 
   ; if I'm susceptible
   [do-with-probability the-infection-odds 
       ; and the infection occurs
       [add-behaviours list-of-micro-behaviours "Behaviours when infected"  [SET-STATE-INFECTED.html]]]
End NetLogo code

Related Micro-behaviours

This uses SET-STATE-INFECTED to conditionally set my state to infected. RANDOM-ENCOUNTER uses this micro-behaviour. CREATE-INFECTION-ODDS-SLIDER sets the the-infection-odds variable.

How this works

When my-state is "susceptible" then the odds of getting the infection are used to determine if I'm infected.

History

This was implemented by Ken Kahn.