React-sim
GitHub
Code for this example

Segregation

0
100
0
100
0
100
0
50

This simulation is based on Schelling's model of segregation.

A territory, in the form of a familiar 2D grid, is randomly populated by citizens from one of two groups. The proportion of one of the groups can be adjusted. Citizens have a tolerance level - if the proportion of neighbors around them which are not from the same group is below their tolerance level, they will move and trade place with another unhappy neighbor. The model stops when the share of citizens which are happy exceeds the threshold.

At high tolerance levels, the model stops soon enough and the territory remains similar to its original state. At lower tolerance levels, islands of similar citizens form and the territory solidifies in a few homogeneous groups. At lowest tolerance levels, the model may never stabilize and citizens are always moving.

Edit this page on GitHub
Previous:
Percolation
Next:
Snake game
React-SimGitHub