Here you will find the source code as well as runnable jars for some of the models I have written and published. Much of the code is written in Java, and requires that you also install the MASON simulation library, which is on the buildpath for each of these models. For models for which I have included a jar file, you can simply download and run to watch the model dynamics under changeable parameter settings – no programming knowledge required. If you’re interested in a model from one of my papers that doesn’t seem to be here, drop me a line and I’ll try to rustle it up for you.


Evolution of Covert Signaling

Reference: Smaldino PE, Flamson TJ, McElreath R (2018) The evolution of covert signaling. Scientific Reports 8: 4905.

Source code (Mathematica): link


Multiplex Network Formation

Reference: Smaldino PE, D’Souza R, Maoz Z (in press) Resilience by structural entrenchment: Dynamics of single-layer and multiplex networks following sudden changes to tie costs. Network Science.

Source code (Java): openABM link


Adoption as a Social Marker

Reference: Smaldino PE, Janssen MA, Hillis V, Bednar J (2017) Adoption as a social marker: Innovation diffusion with outgroup aversion. Journal of Mathematical Sociology 41: 26–45.

Source code (Java): openABM link 


Coevolution of Economic Institutions and Sustainable Consumption

Reference: Waring TM, Goff SH, Smaldino PE (2017) The coevolution of economic institutions and sustainable consumption via cultural group selection. Ecological Economics 131: 524–532.

Source code (NetLogo): openABM link


The Natural Selection of Bad Science

Reference: Smaldino PE, McElreath R (2016) The natural selection of bad science. Royal Society Open Science 3: 160384.

Source code (Java): RSOS link


GENE CLICKER: A Science of Science Tutorial!

Based on my mathematical model of the population dynamics of science (with R. McElreath), I created an interactive tutorial, called GENE CLICKER, as a pedagogical tool to convey some of the difficulties inherent in using science to determine what is true about the world. Check it out.


Social Conformity Despite Preferences for Distinctiveness

Reference: Smaldino PE, Epstein JM. (2015). Social conformity despite individual preferences for distinctiveness. Royal Society Open Science, 2, 140437.

Source code (Java):

Animation: Youtube

Marcel Salathe has also produced a nice javascript implementation of this model.


Institutions and Cooperation in an Ecology of Games

References: Smaldino PE, Lubell M (2011) An institutional mechanism for assortment in an ecology of games. PLOS ONE 6(8): e23019.

Smaldino PE, Lubell M (2014) Institutions and cooperation in an ecology of games. Artificial Life 20: 207–221.

Source code (Java): openABM link


Evolution of Cooperation with Mobile Agents

References: Smaldino PE, Schank JC. (2012). Movement patterns, social dynamics, and the evolution of cooperation.Theoretical Population Biology, 82, 48-58.

Smaldino PE, Schank JC, McElreath R. (2013). Increased costs of cooperation help cooperators in the long run. The American Naturalist, 181(4), 451-463.

Smaldino PE. (2013). Cooperation in harsh environments and the emergence of spatial patterns. Chaos, Solitons & Fractals, 56, 6-12.

Source code (Java):

Runnable jarSpatialPDGame.jar

NetLogo replication


Evolution of Cooperative Breeding in Harsh Environments

Reference: Smaldino PE, Newson L, Schank JC, Richerson PJ (2013) Simulating the evolution of the human family: Cooperative breeding increases in harsh environments. PLOS ONE 8(11): e80753.

Source code (Java): openABM link


An ABM of Optimal Distinctiveness Theory

Reference: Smaldino PE, Pickett CL, Sherman JW, Schank JC. (2012). An agent-based model of social identity dynamics. Journal of Artificial Societies and Social Simulation, 15(4), 7.

Source code (Java):

Runnable jarsocialidentity.jar


Human Mate Choice is a Complex System

Reference: Smaldino PE, Schank JC. (2012). Human mate choice is a complex system. Complexity, 17(5), 11-22.

Source code (Java):


Multi-agent Braitenberg Vehicle Simulation

A little movie from my grad school days. Valentino Braitenberg’s book Vehicles: Experiments in Synthetic Psychology was really inspiring to me. It’s a fantastic little book that I recommend for just about anyone interested in behavior, evolution, mind, robots, and the like. I made a little simulation with a simple Braitenberg vehicle that avoided stationary light sensors. Then I thought, what would happen if there were lots of vehicles, and they all emitted light? Here’s the result. The vehicles start “emitting light” around 0:54.