diff --git a/examples/epstein_civil_violence/epstein_civil_violence/model.py b/examples/epstein_civil_violence/epstein_civil_violence/model.py index f660ecfa..6bce24eb 100644 --- a/examples/epstein_civil_violence/epstein_civil_violence/model.py +++ b/examples/epstein_civil_violence/epstein_civil_violence/model.py @@ -141,3 +141,14 @@ def count_jailed(model): if agent.breed == "citizen" and agent.jail_sentence > 0: count += 1 return count + + @staticmethod + def count_cops(model): + """ + Helper method to count jailed agents. + """ + count = 0 + for agent in model.schedule.agents: + if agent.breed == "cop": + count += 1 + return count