state-making
Model was written in NetLogo 6.1.1
•
Viewed 52 times
•
Downloaded 4 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
;; Copyright Gabriele De Luca, ;; Department of e-Governance and Administration, ;; University for Continuing Education Krems, Austria, ;; gabriele.deluca@donau-uni.ac.at globals [ referendum refugees territory_color highlander-victory? ] breed [individuals individual] breed [borders border] breed [fires fire] undirected-link-breed [connections connection] individuals-own [ preference ; this is the political preference, it can assume any value. Its sign determines the vote expressed by the individual in-country? ] patches-own [ territory? ] to setup clear-all set-default-shape individuals "person" set-default-shape fires "fire" set territory_color red + 3 set highlander-victory? False make-territory repeat number-individuals [ make-individuals ] reset-ticks end ; initialise individuals to make-individuals create-individuals 1 [move-to one-of patches with [territory? = True] set size 25 set preference variance-of-preferences * 1.1 ; otherwise the simulation stops at turn 1 with 50% chances set in-country? True ] end to make-territory import-pcolors "borders.png" ask patches [set territory? False] ask patches with [pcolor = white] [set pcolor yellow + 3] ask patches with [pcolor = black] [set pcolor territory_color set territory? True] end to go if (count individuals with [in-country? = True] = 0) [ set referendum highlanders set highlander-victory? True stop] if (referendum < 0) [ set highlander-victory? True stop] if ticks > final-ticks [stop] ask individuals [move] update-preferences make-referendum repeat highlanders [kill] compute-refugees tick end to move let closest-fires fires in-radius perception-range let how_many_fires_in_range count closest-fires; assert whether there are any fires in range let fires_in_range? how_many_fires_in_range > 0 ifelse fires_in_range? [ let xsum 0 let ysum 0 ask closest-fires [set xsum (xsum + xcor) set ysum (ysum + ycor)] let xaverage (xsum / how_many_fires_in_range) let yaverage (ysum / how_many_fires_in_range) facexy xaverage yaverage left 180 forward speed * 2 ]; if True [right random 90 left random 90 forward speed] ; else let currently-on-territory? [territory?] of patch-here ifelse (currently-on-territory?) [set in-country? True] [set in-country? False] end to make-referendum ifelse (count individuals with [in-country? = True] > 0 ) ; if there are individuals in the country [set referendum mean [preference] of individuals with [in-country? = True] ] ; else, there are no individuals in the country so the highlanders decide [set referendum 0 - highlanders] end to update-preferences ask individuals [ let draw random-normal 0 variance-of-preferences let update preference + draw set preference update] end to kill let in-country-individuals individuals with [in-country? = True] if count in-country-individuals > 0 [ let murdered one-of in-country-individuals with-max [preference] ask murdered [hatch-fires 1 [] if any? other individuals in-radius perception-range [ ask other individuals in-radius perception-range [ ; RUN AWAY GOES HERE let draw random-normal 0 1 let abs-draw abs draw let update preference + abs-draw set preference update] ; I am very sorry but the order of execution for contatenated operations in this language is a mess and this is the only way I am sure that it does what I want ] die] ] end to compute-refugees set refugees count individuals with [in-country? = False] end
There is only one version of this model, created almost 2 years ago by Gabriele De Luca.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
state-making.png | preview | Preview for 'state-making' | almost 2 years ago, by Gabriele De Luca | Download |
This model does not have any ancestors.
This model does not have any descendants.