The mechanics of contentious politics: an agent-based modeling approach