This is an implementation based on Epstein's civil unrest model. Citizens (green) randomly move around and decide to rebel based on a number of factors. Cops randomly move around and arrest active agents.
Citizens' decision to rebel is based on a number of factors, but most significantly it is the ratio of cops to active agents among their neighbors. The higher that ratio, the higher the likelihood of the citizen being arrested, and vice versa.
Modifying any of the properties will affect the behavior of the model, which is mostly characterized by the frequency and intensity of "rebellions", when large numbers of agents become active.
See also the Python implementation of this simulation.