Skip to content

Latest commit

 

History

History
 
 

examples

Example Code

This directory contains example models meant to test and demonstrate Mesa's features, and provide demonstrations for how to build and analyze agent-based models. For more information on each model, see its own Readme and documentation.

Models

Classic models, some of which can be found in NetLogo's/MASON's example models.

bank_reserves

A highly abstracted, simplified model of an economy, with only one type of agent and a single bank representing all banks in an economy.

color_patches

A cellular automaton model where agents opinions are influenced by that of their neighbors. As the model evolves, color patches representing the prevailing opinion in a given area expand, contract, and sometimes disappear.

conways_game_of_life

Implementation of Conway's Game of Life, a cellular automata where simple rules can give rise to complex patterns.

epstein_civil_violence

Joshua Epstein's model of how a decentralized uprising can be suppressed or reach a critical mass of support.

boid_flockers

Boids-style flocking model, demonstrating the use of agents moving through a continuous space following direction vectors.

forest_fire

Simple cellular automata of a fire spreading through a forest of cells on a grid, based on the NetLogo Fire model.

hex_snowflake

Conway's game of life on a hexagonal grid.

pd_grid

Grid-based demographic prisoner's dilemma model, demonstrating how simple rules can lead to the emergence of widespread cooperation -- and how a model activation regime can change its outcome.

schelling (GUI and Text)

Mesa implementation of the classic Schelling segregation model.

boltzmann_wealth_model

Completed code to go along with the tutorial on making a simple model of how a highly-skewed wealth distribution can emerge from simple rules.

wolf_sheep

Implementation of an ecological model of predation and reproduction, based on the NetLogo Wolf Sheep Predation model.

sugarscape_cg

Implementation of Sugarscape 2 Constant Growback model, based on the Netlogo Sugarscape 2 Constant Growback

virus_on_network

This model is based on the NetLogo model "Virus on Network".

Feature examples

Example models specifically for demonstrating Mesa's features.

charts

A modified version of the "bank_reserves" example made to provide examples of mesa's charting tools.

Shape Example

Example of grid display and direction showing agents in the form of arrow-head shape.