Skip to content

Commit

Permalink
fix: Add count_cops method to the model (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
jurreaserna authored Sep 15, 2023
1 parent 6f3e077 commit 031f3df
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/epstein_civil_violence/epstein_civil_violence/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 031f3df

Please sign in to comment.