Each sphere is a person: blue is susceptible, red is infected, green is recovered/immune. Infected agents wander the plane and infect any susceptible neighbor within a contact radius at rate β, then recover at rate γ. Vaccinating a fraction of the population moves them straight to "recovered" before the outbreak starts, shrinking the pool of people who can catch it.
dS/dt = -β S I / N
dI/dt = β S I / N - γ I
dR/dt = γ I
R0 = β / γ
- Transmission rate β — probability-per-contact the disease jumps to a susceptible neighbor; higher β spreads infection faster.
- Recovery rate γ — how quickly infected agents recover (turn green); higher γ shortens the outbreak.
- Population size — total agents simulated on the plane.
- Vaccination toggle — pre-immunizes a percentage of the population, directly lowering R0's effective reach.
Public-health agencies use this exact SIR framework to forecast epidemic curves and estimate the vaccination coverage needed for herd immunity (1 − 1/R0).