Segregation Model - BehaviorSearch
Model was written in NetLogo 6.3.0
•
Viewed 79 times
•
Downloaded 9 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Info tab cannot be displayed because of an encoding error
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [ percent-similar ;; on the average, what percent of a turtle's neighbors ;; are the same color as that turtle? percent-unhappy ;; what percent of the turtles are unhappy? ] turtles-own [ happy? ;; for each turtle, indicates whether at least %-similar-wanted percent of ;; that turtles' neighbors are the same color as the turtle similar-nearby ;; how many neighboring patches have a turtle with my color? other-nearby ;; how many have a turtle of another color? total-nearby ;; sum of previous two variables ] to setup clear-all if number > count patches [ user-message (word "This pond only has room for " count patches " turtles.") stop ] ;; create turtles on random patches. ask n-of number patches [ sprout 1 [ set color red ] ] ;; turn half the turtles green ask n-of (number / 2) turtles [ set color green ] update-variables reset-ticks end to go if all? turtles [happy?] [ stop ] move-unhappy-turtles update-variables tick end to move-unhappy-turtles ask turtles with [ not happy? ] [ find-new-spot ] end to find-new-spot rt random-float 360 fd random-float 10 if any? other turtles-here [ find-new-spot ] ;; keep going until we find an unoccupied patch move-to patch-here ;; move to center of patch end to update-variables update-turtles update-globals end to update-turtles ask turtles [ ;; in next two lines, we use "neighbors" to test the eight patches ;; surrounding the current patch set similar-nearby count (turtles-on neighbors) with [color = [color] of myself] set other-nearby count (turtles-on neighbors) with [color != [color] of myself] set total-nearby similar-nearby + other-nearby set happy? similar-nearby >= ( pct-similar-wanted * total-nearby / 100 ) ] end to update-globals let similar-neighbors sum [similar-nearby] of turtles let total-neighbors sum [total-nearby] of turtles set percent-similar (similar-neighbors / total-neighbors) * 100 set percent-unhappy (count turtles with [not happy?]) / (count turtles) * 100 end ; Copyright 2006 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created almost 2 years ago by Hendra Kusumah.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Segregation Model - BehaviorSearch.png | preview | Preview for 'Segregation Model - BehaviorSearch' | almost 2 years ago, by Hendra Kusumah | Download |
This model does not have any ancestors.
This model does not have any descendants.