a→ab

computation, game design, and experimentation


front page | about | archives | code dump | c.s. for mere mortals | tags | rss feed

A Simplified Schelling Model

December 2, 2013
tags: model, python, code-dump, segregation, complexity, schelling

I coded up a simplified version of the Schelling segregation model today. I thought I'd share the code below.

Here's some output (with numcells above changed to 40):

+.++++++ .+.+.....++.++....++...++....+..+.. ++.++
+.++++++ .+.+.....++.++....++...++....+..+.. ++.++
+.++++++ .+.+.....++.++....++...++....+..+.. ++.++
+.+++++++.+.+.....++.+ ....++...++....+..+.. ++.++
+.+++++++.+.+.....++.+ ....++...++....+..+.. ++.++
+.+++++++.+.+.....++.+ ....++...++....+..+.. ++.++
+.+++++++.+.+.....++.+ ....++...++....+..+.. ++.++
+.+++++++.+.+.....++.+ ....++...++....+..+.. ++.++
+.+++++++.+.+.....++.+ ....++...++....+..+. .++.++
+.+++++++.+.+.....++.+ ....++...++....+..+. .++.++
<...snip...>
+++++++++++++......++++....+ ... +............++++
+++++++++++++......++++....+ ... +............++++
+++++++++++++......++++....+ ... +............++++
+++++++++++++......++++....+ ... +............++++
Done

Pretty neat -- it works! I love complexity.

blog comments powered by Disqus