# Chapter 4 - Examples of ABMs built with Mesa

```{admonition} Video overview
:class: tip

This short video previews the five Mesa models explored in Chapter 4.

<video class="chapter-overview-video" controls playsinline preload="metadata" width="100%" poster="../videos/video_4_1_simple_models_overview_poster.jpg" aria-label="Chapter 4 overview: examples of agent-based models built with Mesa">
  <source src="../videos/video_4_1_simple_models_overview.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>
```

With your first model built in Chapter 3, this chapter puts Mesa to work on four classic agent-based models, then hands you a fifth to extend on your own.

```{admonition} Learning objectives
:class: note

By the end of this chapter, you will be able to:

1. Build and run classic agent-based models in Mesa, including a simple economy, the Game of Life, traffic, and a virus spreading on a network (Models 1–4).
2. Work with different environments, from regular grids to networks, and see how structure shapes the resulting behaviour.
3. Collect model and agent data with Mesa's DataCollector, and run parameter sweeps with batch runs.
4. Visualise model dynamics and interpret the emergent patterns they produce.
5. Extend and experiment with each model by completing its interactive tasks and exercises (Model 5).
```

This chapter presents a set of simple, focused models that consolidate the agent-based modelling (ABM) concepts and Mesa features from Chapter 3. The models differ in their grid structures and levels of complexity, ranging from simple spatial grids to network-based environments, and each one highlights a particular Mesa feature. Every model is structured in two parts: an introduction to the model and its learning objectives, followed by interactive tasks and exercises that ask you to reflect on model behaviour, discuss findings, and extend the code.

::::{grid} 1 1 3 3
:gutter: 3

:::{grid-item-card} Model 1 · Simple economy
:link: section_4_1_simple_economy_introduction
:link-type: doc
A wealth-exchange model, focusing on the DataCollector and visualisation.
:::

:::{grid-item-card} Model 2 · Game of Life
:link: section_4_2_game_of_life_introduction
:link-type: doc
The classic cellular automaton, focusing on agent behaviour and visualisation.
:::

:::{grid-item-card} Model 3 · Traffic
:link: section_4_3_traffic_introduction
:link-type: doc
A one-lane traffic model, focusing on the DataCollector and batch runs.
:::

:::{grid-item-card} Model 4 · Virus on a network
:link: section_4_4_virus_on_a_network_introduction
:link-type: doc
Disease spreading over a network, focusing on agent behaviour and the DataCollector.
:::

:::{grid-item-card} Model 5 · Event scheduling
:link: section_4_5_event_scheduling_introduction
:link-type: doc
Speeding up a model by scheduling events instead of activating every agent each step.
:::

::::

Begin with {doc}`Model 1, the simple economy <section_4_1_simple_economy_introduction>`, and work through the models in order.
