What you're seeing
Each occupied cell holds an agent of one of two types. An agent looks only at its eight immediate neighbors (the Moore neighborhood), counts how many of the occupied ones share its type, and decides whether it is happy. If too few of its neighbors are like it, it is unhappy and, on the next sweep, picks up and moves to a randomly chosen empty cell. There is no global planner and no agent who prefers a segregated world. Each is satisfied as long as it is not too outnumbered locally. Run it and the population nonetheless drifts, sweep by sweep, into large single-color regions separated by sharp borders. The grid wraps at the edges, so a block that runs off one side continues on the other.
The rule
Fix a tolerance threshold τ shared by every agent. For an agent of type X:
- Let s be the number of its occupied neighbors that are also type X, and n the total number of occupied neighbors (0 to 8).
- The agent is happy when
s / n ≥ τ— at least a fraction τ of its neighbors match it. - An agent with no occupied neighbors (n = 0) is counted as happy: it has no one to be unhappy about. (An explicit modeling choice — see the notes.)
Every sweep, all currently-unhappy agents are found and each is relocated to a uniformly-random empty cell — the classic "random relocation" variant of Schelling's model. The number of agents of each type never changes; they only move. The system runs until (nearly) everyone is happy, at which point it freezes into segregated blocks — and it does so even for surprisingly small τ.
Why it matters
This is the landmark demonstration that macro-level outcomes need not mirror micro-level preferences. No agent in the model wants segregation; each is perfectly willing to live as a local minority, often a large one. Set the tolerance to around 30% — every agent is happy to be outnumbered nearly three-to-one — and the grid still collapses into segregated patches. Mild, individually reasonable preference is sufficient to produce a sharply sorted whole that nobody chose. Thomas Schelling used this to make a general and durable point about how micromotives aggregate, often perversely, into macrobehavior; he shared the 2005 Nobel Memorial Prize in Economic Sciences (with Robert Aumann) for his broader work on conflict and cooperation. The model is also a founding example of agent-based modeling: a system understood not by solving an equation but by letting many simple actors interact and watching what falls out.
In the wild
Schelling built this with residential racial segregation in mind, and it carries a genuinely useful, sobering lesson: you do not need to assume that people want segregation, or that anyone is acting on extreme prejudice, to get a segregated city. A weak preference, compounded across many independent choices, can be enough.
But it is essential to be honest about what the model does and does not show. It demonstrates that mild preference is sufficient to produce segregation — not that real-world segregation is only, or even mainly, the product of mild individual preference. Actual residential segregation has deep structural, economic, legal, and discriminatory causes: redlining, exclusionary zoning, lending discrimination, unequal wealth and income, and outright hostility, among others. These are not in the model. The grid is a clean thought-experiment that isolates one mechanism and shows it is powerful; reading it as a complete explanation of how cities actually segregated would be a serious misuse. Treat it as a lens that reveals one force, not as a theory that accounts for the whole.
Try this
- Start at the default and watch it sort. Then drop the tolerance to ~30% and reset: agents tolerate being a heavy minority, yet the grid still segregates. That gap is the whole point.
- Keep lowering tolerance and hunt for the threshold where the population stays mixed — where the segregation index barely climbs above its random starting value. It is lower than most people guess.
- Push tolerance high (above ~70%) and watch what happens: too many agents are unhappy at once, empty cells get scarce, and the system can thrash without ever settling — perfectionism prevents peace.
- Lower the density to leave more empty space. More room to move makes it easier for everyone to find a comfortable spot, and segregation sets in faster and cleaner.
References
- Schelling, T. C. (1971). "Dynamic Models of Segregation." Journal of Mathematical Sociology 1(2), 143–186.
- Schelling, T. C. (1978). Micromotives and Macrobehavior. W. W. Norton & Company.
- The Royal Swedish Academy of Sciences (2005). "The Sveriges Riksbank Prize in Economic Sciences in Memory of Alfred Nobel 2005" — awarded jointly to Robert J. Aumann and Thomas C. Schelling. nobelprize.org.
- Hatna, E. & Benenson, I. (2012). "The Schelling Model of Ethnic Residential Dynamics: Beyond the Integrated–Segregated Dichotomy of Patterns." Journal of Artificial Societies and Social Simulation 15(1), 6.