Skip to content

Instantly share code, notes, and snippets.

@ncase ncase/
Last active Feb 3, 2018

What would you like to do?
DRAFT - Schelling's Segregation Solitaire Sexism Simulator

These are the adorable Polygon People.

They're 50% Triangles, 50% Squares, and 100% slightly biased against each other.

Emphasis on the word slightly. A Polygon would be happy with an even 50/50 split of neighbours of different types, but if less than 33% of their neighbours are like them, they will be unhappy, and want to move somewhere else.

Keep that in mind. Every single Polygon would be happy with a fully integrated neighbourhood. However, let's see what happens over time...


Click and drag unhappy Polygons to a random empty square.
Repeat until all Polygons are happy.

And the result... near-complete segregation.

This wasn't just a fluke. You can run this process over and over again with different boards, and it will almost always tend towards a highly segregated outcome.

Try it yourself! This next interactive bit automates the Polygons moving around, and measures the average % of a Polygon's neighbours that are the same shape. We'll call this the Sameness %.

Because it's random at first, the Sameness % will usually start at around 50%. But let's see what happens, what almost always happens, once they start moving around.


Click GO to start the simulation.
Click RESET to create a new random board of Triangles and Squares.

  • The system is bad, even if the agents are good.
  • Institutional Shapism vs Individual Shapism.
  • An attack on sexism != An attack on men.
  • (?) Tragedy of the Commons - personal benefit of your biases vs global stagnation over sameness?
  • "Don't hate the player, hate the game"?

Right now, the "unhappy" threshold for self-similar neighbours is at 33%. Let's call this the Bias %. Now, play around with the Bias %, and see what level of Sameness % this results in at the end.


Use slider to change Polygons' Bias %
It also graphs the Sameness % this results in.

  • Small biases can lead to large segregation.
  • Too large of a bias, and you won't even have a stable outcome.
  • This is Thomas Schelling's depressing discovery
  • Applies not just to racial segregation in major cities, but also women in STEM.

Now you may be thinking, well then the solution to desegregation is obvious, right? Just turn the bias all the way down to zero? Alas, in real life, we are not starting out on a randomly distributed board.

Here's a simulation where the board starts off very segregated - see what happens when you adjust the Bias %.


As you can see, nothing happens. In fact, it can get even more segregated if you turn the Bias % upwards.

  • Equality is not an equilibrium.
  • You need active measures. (I used to believe we didn't, Schelling changed my mind?)
  • Being a "good" person is like being a "clean" person - it takes effort.

New rule: Polygons are now also unhappy if too many of their neighbours are exactly like them. Let's call this the Conformity %. This next simulation starts with a segregated neighbourhood, and all Polygons at 20% Bias and 99% Conformity. (They're only upset it ALL of their neighbours are like them)


  • Top-down approaches are ineffective and hard to implement.
  • An effective bottom-up approach to re-integration.
  • The personal benefits of diversity in your social circles/workplace/conferences.



  • bring the neighbourhood to segregation and back to equality, again and again.
  • with low enough Conformity %, you can have a resulting Sameness % of LESS than 50%.

Cautiously optimistic conclusion

  • Summary of lessons
  • Some concrete call to actions on sharing this message, and tips/further resources to improving the diversity in their conferences/workplace/social circles.
  • Bottom-up approach means every bit of help counts. Besides, there's personal short-term & long-term benefits to increasing diversity in your local circles.
  • Creative Commons Zero: use this in your classrooms, remix this into videos/infographics, or some other creative use. Email us to let us know how you're using this work!


This comment has been minimized.

Copy link

commented Feb 3, 2018

Awesome! Now that you've managed to make our personal role in segregation vivid and inspire us to be willing to be a bit uncomfortable, what about a game to show what it would take to reverse the situation; that is, what if a number of people consciously chose to move to a place where most of the people are different from them, and also made a conscious effort to become friends with those new (different) neighbors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.