globals [n-of-changers] patches-own [ vote ;; my vote (0 or 1) total ;; sum of votes around me oldvote ;; previous vote ] to setup ca ask patches [ifelse (random-float 100) < initial-percent-red [set vote 0] [set vote 1] recolor-patch ] end to go ask patches [ set total (sum [vote] of neighbors) set oldvote vote] ;; use two ask patches blocks so all patches compute "total" ;; before any patches change their votes ask patches [ let majority (max list total (8 - total)) let actionstring (word "action" majority "-" (8 - majority)) let strategy runresult actionstring set vote newvote vote total strategy recolor-patch ] set n-of-changers sum [abs (vote - oldvote)] of patches plot n-of-changers end to recolor-patch ;; patch procedure ifelse vote = 0 [ set pcolor red ] [ set pcolor blue ] end to-report newvote [myoldvote neighbortotal mystrategy] if mystrategy = "with majority" [report ifelse-value (total > 4) [1] [0]] if mystrategy = "keep last decision" [report myoldvote] if mystrategy = "change last decision" [report (1 - myoldvote)] if mystrategy = "oppose majority" [report ifelse-value (total > 4) [0] [1]] end @#$#@#$#@ GRAPHICS-WINDOW 432 10 644 243 50 50 2.0 0 10 1 1 1 0 1 1 1 -50 50 -50 50 0 0 1 ticks CC-WINDOW 5 345 653 440 Command Center 0 BUTTON 28 13 83 46 setup setup NIL 1 T OBSERVER NIL NIL NIL NIL BUTTON 90 13 145 46 NIL go T 1 T OBSERVER NIL NIL NIL NIL MONITOR 447 280 536 325 blue patches count patches with\n [ pcolor = blue ] 0 1 11 MONITOR 547 280 635 325 red patches count patches with\n [ pcolor = red ] 0 1 11 CHOOSER 28 120 204 165 action5-3 action5-3 "with majority" "keep last decision" "change last decision" "oppose majority" 0 CHOOSER 27 173 203 218 action6-2 action6-2 "with majority" "keep last decision" "change last decision" "oppose majority" 0 CHOOSER 27 227 203 272 action7-1 action7-1 "with majority" "keep last decision" "change last decision" "oppose majority" 0 CHOOSER 28 286 204 331 action8-0 action8-0 "with majority" "keep last decision" "change last decision" "oppose majority" 0 CHOOSER 29 69 205 114 action4-4 action4-4 "keep last decision" "change last decision" 0 SLIDER 232 69 404 102 initial-percent-red initial-percent-red 0 100 50 1 1 NIL HORIZONTAL PLOT 218 178 418 328 Changers NIL NIL 0.0 10.0 0.0 10.0 true false PENS "default" 1.0 0 -16777216 true MONITOR 287 114 385 159 percent-red 100 * count patches with [vote = 0] / (count patches) 1 1 11 @#$#@#$#@ WHAT IS IT? ----------- This model is a simple cellular automaton that simulates voting distribution by having each patch take a "vote" of its eight surrounding neighbors, then perhaps change its own vote according to the outcome. HOW TO USE IT ------------- Click the SETUP button to create arandom distribution of blue and red patches. The percent-red slider allows you to set the initial percentage of red cells (approximately). Click GO to run the simulation. The 8 neighbors of a cell can have a 4-4 tie, a 5-3 majority, a 6-2 majority, a 7-1 majority, or a 8-0 majority. The choosers allow you to define the cell's behaviour for each of the possible majorities. The cell can 1) go with the majority 2) stay with it's last decision 3) change it's last decision 4) vote against the majority THINGS TO NOTICE ---------------- Watch how any setup quickly settles to a static state when voters go for the majority if there is one. Watch what happens when the voter only switches when there is no majority (i.e. a 4-4 tie)? How is the result different? Watch what happens when the voter goes for the majority for small majorities, but opposes strong majorities. RELATED MODELS -------------- Ising (a physics model, but the rules are very similar) CREDITS AND REFERENCES ---------------------- The original model is described in Rudy Rucker's "Artificial Life Lab", published in 1993 by Waite Group Press. It has been modified by Erich Neuwirth, University of Vienna To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Voting model. http://ccl.northwestern.edu/netlogo/models/Voting. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 1998 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/Voting for terms of use. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 5 40 250 150 205 260 250 @#$#@#$#@ NetLogo 4.0.4 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 @#$#@#$#@