A group of agents share a resource and agents will become sufficiently motivated to adopt a rule to constraint their freedom if they experience resource scarcity and developed mutual trust relationships.
This is a replication of Janssen and Ostrom (2006) in NetLogo. The model was originally implemented in Cormas.
Janssen, M.A., and E. Ostrom (2006). Adoption of a New Regulation for the Governance of Common-Pool Resources by a Heterogeneous Population. In Inequality, Cooperation, and Environmental Sustainability, ed. Jean-Marie Baland, Pranab Bardhan, and Samuel Bowles. Princeton, NJ: Princeton University Press, pp. 60-96.