Here you will find the source code as well as runnable jars for some of the models I have written and published. Unless otherwise indicated, source code will be in Java, and requires that you also install the MASON simulation library, which is on the buildpath for each of these models. Feel free to contact me with any questions. 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 – I’m usually happy to share.


matching-closeup2Human mate choice is a complex system

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



SID_figAn agent-based model of social identity dynamics

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.


Runnable jarsocialidentity.jar


PDgameA spatial model for the evolution of cooperation

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:

Runnable jarSpatialPDGame.jar

NetLogo replication


Social conformity despite individual preferences for distinctiveness

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


Animation: Youtube

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


Science of Science

bayesTutorial2aReference: McElreath R, Smaldino PE. (2015). Replication, communication, and the population dynamics of scientific discovery. PLOS ONE, 10(8), e0136088.

This model was solved entirely analytically. However, to develop intuitions for the system, I also wrote simulation code. The runnable JAR is available here. In addition, 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.

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.