This implementation of Joshua Epstein’s Civil Violence Model uses two subclasses of the Agent base class — Civilian and Cop (see the link above for simulation parameters).
In this visualization, using the CanvasRenderer, Cops are represented by the letter c. Civilians are represented by a period, 0, or *. Every turn, some Civilians will go from inactive to active, depending on their own threshold and the exogenous legitimacy (i.e. of the government). However, a Cop who is next to an active Civilian will arrest them, visualized by 0 for a number of terms set by the
jail term. By updating parameters for legitimacy, jail term, % full, and % Cops, different dynamics will arise, from a peaceful population to periodic outbursts to near-constant anarchy.