Libraries‎ > ‎Epidemics‎ > ‎

Contact acquaintances

BehaviourComposer: ignore everything before this.
I encounter the-encounter-fraction of my acquaintances and possibly infect them.
Begin micro-behaviour

Contact acquaintances

Begin NetLogo code:
do-every 1
   [add-behaviours-to select-n (the-encounter-fraction * count link-neighbors) link-neighbors 
                      list-of-micro-behaviours "Encounter Behaviours" []]
End NetLogo code

How this works

On every cycle it selects randomly the-encounter-fraction of the acquaintances and adds the Encounter Behaviours to them. The BehaviourComposer's select-n extension to NetLogo deals with fractions probabilistically. E.g. if 3.8 people are to be selected then on average 20% of the time 3 are selected and 80% of the time 4 are selected.

History

This was implemented by Ken Kahn on 1 February 2011.

BehaviourComposer: ignore everything after this.
Comments