Rumor Mill- Sam's Extension

Rumor Mill- Sam's Extension preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 533 times • Downloaded 36 times • Run 0 times
Download the 'Rumor Mill- Sam's Extension' modelDownload this modelEmbed this model

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 [
  color-mode       ;; 0 = normal, 1 = when heard, 2 = times heard
  clique           ;; how many patches have heard the rumor
  previous-clique  ;; value of clique from last tick, for use in the "successive" plots
]

patches-own [
  times-heard    ;; tracks times the rumor has been heard
  first-heard    ;; clock tick when first heard the rumor
  just-heard?    ;; tracks whether rumor was heard this round -- resets each round
]

;;; setup procedures

to setup [seed-one?]
  clear-all
  set color-mode 0
  set clique 0
  ask patches
    [ set first-heard -1
      set times-heard 0
      set just-heard? false
      recolor ]
  ifelse seed-one?
    [ seed-one ]
    [ seed-random ]
  reset-ticks
end 

to seed-one
  ;; tell the center patch the rumor
  ask patch 0 0
    [ hear-rumor 0 ]
end 

to seed-random
  ;; seed with random number of rumor sources governed by init-clique slider
  ask patches with [times-heard = 0]
    [ if (random-float 100.0) < init-clique
        [ hear-rumor 0 ] ]
end 

to go
  if all? patches [times-heard > 0]
    [ stop ]
  ask patches
    [ if times-heard > 0
        [ spread-rumor ] ]
  update
  tick
end 

to spread-rumor  ;; patch procedure
  let neighbor nobody ;;find neighbors
  ifelse telephone?
    [ set neighbor one-of patches ]
    [ set neighbor one-of neighbors ]
  ask neighbor [  if (random-float 100.0) < probability-spread-rumor [set just-heard? true] ] ;;set probability
end 

to hear-rumor [when]  ;; patch procedure
  if first-heard = -1 ;;just heard neighbors
    [ set first-heard when
      set just-heard? true ] 
  set times-heard times-heard + 1
  recolor
end 

to update
  ask patches with [just-heard?]
    [ set just-heard? false
      hear-rumor ticks ]
  set previous-clique clique
  set clique count patches with [times-heard > 0]
end 

;;; coloring procedures

to recolor  ;; patch procedure
  ifelse color-mode = 0
    [ recolor-normal ]
    [ ifelse color-mode = 1
      [ recolor-by-when-heard ]
      [ recolor-by-times-heard ] ]
end 

to recolor-normal  ;; patch procedure
  ifelse first-heard >= 0
    [ set pcolor red ]
    [ set pcolor blue ]
end 

to recolor-by-when-heard  ;; patch procedure
  ifelse first-heard = -1
    [ set pcolor black ]
    [ set pcolor scale-color yellow first-heard world-width 0 ]
end 

to recolor-by-times-heard   ;; patch procedure
  set pcolor scale-color green times-heard 0 world-width
end 

;;; mouse handling

to spread-rumor-with-mouse
  if mouse-down?
    [ ask patch mouse-xcor mouse-ycor
        [ hear-rumor ticks ]
        display ]
end 


; Copyright 1997 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 9 years ago by Sawaros Thanapornsangsuth.

Attached files

File Type Description Last updated
Rumor Mill- Sam's Extension.png preview Preview for 'Rumor Mill- Sam's Extension' over 9 years ago, by Sawaros Thanapornsangsuth Download

This model does not have any ancestors.

This model does not have any descendants.