Standing ovation problem replica

No preview image

1 collaborator

Default-person Jean van Haperen (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 436 times • Downloaded 36 times • Run 0 times
Download the 'Standing ovation problem replica' modelDownload this modelEmbed this model

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

globals
[n-white
]


turtles-own[
 standing?
 intrinsic-appraisal
 neighborhood 
 standing-in-draw
]

to setup
  clear-all
  resize-world  0 (R - 1) 0 (C - 1)
  setup-turtles
  reset-ticks
end 

to setup-turtles
  set-default-shape turtles "circle" 

  ask patches [sprout 1]
  ask turtles [
    set intrinsic-appraisal random-float 1
    set standing-in-draw (random 2)
    ifelse intrinsic-appraisal > initial-standing-treshold
    [set standing? true] [set standing? false]]
  ask turtles [recolor] 
  ask turtles
  
  [set neighborhood turtles-on (neighbors with [pycor >= [pycor] of myself])]
end 

to go  
  let n-white-t-1 n-white
  set n-white count (turtles with [color = white])
  if n-white >= R * C [setup]
  if n-white-t-1 = n-white [setup]
  
  let number-black count (turtles with [color = black])
  if number-black >= R * C [setup]
  tick
  ask turtles [reconsider]
  ask turtles [recolor]
end 
  
  ; turtle commands 
  
  To recolor
  ifelse standing? [set color black][set color white]
end 

to reconsider
  let standing-number count (neighborhood with [standing?])
  let pct-neighbors-standing (standing-number / count neighborhood)
   if pct-neighbors-standing > 0.5
  [set standing? true]
   if pct-neighbors-standing < 0.5
  [set standing? false]
 
  if pct-neighbors-standing = 0.5
  [ifelse standing-in-draw = 1
  [set standing? true] [set standing? false]]
end 
  
  

There is only one version of this model, created about 10 years ago by Jean van Haperen.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.