Warring States
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
The idea is to eventually turn this into a NetLogo version of Geosim -- maybe someday. (Google "Geosim".)
HOW IT WORKS
At each tick, we pick a pair of adjacent differently colored patches. One attacks the other and takes it over (by coloring it with its own color). If the attacked patch
had a capital on it, the capital disappears and all of its patches become part of the attacking nation.
HOW TO USE IT
You'll probably want to use the speed slider to run the model at faster than the default speed, since only a little bit of action happens at each tick.
EXTENDING THE MODEL
The rules don't prevent a nation's territory from becoming non-contiguous. One nation can end up with "islands" of territory that are not connected to the capital. Add code that detects when this happens and reassigns the marooned patches to the conquering nation.
The code is written for simplicity, not efficiency. In relatively small patch worlds it doesn't matter, but if we wanted to run large simulations, smarter (and longer and harder to understand) code could make them run faster.
RELATED MODELS
MaterialSim Grain Growth
GenDrift P Local
Voronoi
Ising
Patch Clusters Example
Comments and Questions
globals [ nation-colors ] patches-own [ capital ;; capitals are turtles. every patch knows which turtle ;; is the capital of its state. ] to setup clear-all set-default-shape turtles "dot" ;; hopefully these colors are visually distinguishable set nation-colors (sentence base-colors (map [? + 3] base-colors) (map [? - 3] base-colors)) ask patches [ set capital nobody ] ;; We start with 14 nations because that's how ;; many base colors NetLogo has. With more than ;; 14 nations we'd have trouble giving them each ;; a unique, easily visually distinguishable color. ask n-of (length nation-colors) patches [ sprout 1 [ set size 2 ;; easier to see set color black set pcolor item who nation-colors set capital self ] ] grow-nations reset-ticks end to grow-nations ;; This is some arbitrary code that gives a rough, randomized ;; approximation of a Voronoi diagram, to use as a plausible ;; initial state for the system. loop [ let empty patches with [capital = nobody] if not any? empty [ stop ] ask empty [ set capital [capital] of one-of neighbors4 if capital != nobody [ set pcolor [pcolor] of capital ] ] ] end to go if count turtles = 1 [ stop ] ;; first find two adjacent patches that differ in color let attacker nobody let target nobody while [target = nobody] [ set attacker one-of patches ask attacker [ set target one-of neighbors4 with [capital != [capital] of myself] ] ] ;; now attack! ask target [ set pcolor [pcolor] of attacker set capital [capital] of attacker ] let sacked one-of turtles-on target if sacked != nobody [ ask patches with [capital = sacked ] [ set pcolor [pcolor] of attacker set capital [capital] of attacker ] ask sacked [ die ] ] ;; we're done, so advance the tick counter tick end
There are 2 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.