Name Game
No preview image
Model was written in NetLogo 6.0
•
Viewed 257 times
•
Downloaded 20 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
;; creates a new lattice globals [ spoken value-ab value-aa value-ba value-bb k this-cluster my-palette ] turtles-own [ inventory memory cluster myword ] to setup clear-all ask patches [ set pcolor white ] set my-palette [ [255 127 39] [255 0 0] [255 255 0] [0 255 0] [0 64 128] [0 255 255] [128 128 255] [128 0 128] [255 0 128] [128 128 0] [0 0 0] [133 122 122] [255 127 39] [255 0 0] [255 255 0] [0 255 0] [0 64 128] [0 255 255] [128 128 255] [128 0 128] [255 0 128] [128 128 0] [0 0 0] [133 122 122] ] set k degree if topology = "Fully Connected" [ setup-fc ] if topology = "Ring Lattice" [ setup-ringlat ] if topology = "Random" [ setup-erdos-renyi ] ask links [ set color grey set hidden? true ] ask turtles [ construct-agent ] reset-ticks end to go let thislink one-of links let pair [who] of [both-ends] of thislink ask links [ set color [ 197 197 197] set thickness 0.1 ] ask thislink [ set hidden? false set color red set thickness 0.3 ] let switch random 2 let speaker item switch pair let hearer item (1 - switch) pair set speaker turtle speaker set hearer turtle hearer if length [inventory] of speaker = 0 [ ask speaker [ invent-word ] ] set spoken one-of [inventory] of speaker ; Success! ifelse length filter [ [?1] -> ?1 = spoken ] [ inventory ] of hearer > 0 [ ask hearer [ set inventory (list spoken) set-color-ng spoken ] ask speaker [ set inventory (list spoken) ] ] [ ask hearer [ set inventory lput spoken inventory ] ] ask speaker [ set-color-ng spoken ] tick end to construct-agent set inventory [] set memory n-values count link-neighbors [ 1 ] ; set memory n-values count link-neighbors [ 2 ] ; set memory n-values count link-neighbors [ (random 2) + 1 ] set color black set shape "circle" end to set-color-ng [ value ] ifelse N > 24 [ set color value ] [ let this-color item 0 [who] of turtles with [ myword = value ] set color item this-color my-palette if this-color < 12 [ set shape "circle" ] if this-color >= 12 [ set shape "circle" ] ] end to invent-word let new-word random 100000000000 set inventory lput new-word inventory set myword new-word end to setup-ringlat crt N [ set color black ] wire-ringlat end to wire-ringlat layout-circle (sort turtles) max-pxcor - 1 layout-circle (sort turtles with [ who mod 2 = 0] ) max-pxcor - 4 ;; iterate over the turtles let ni 0 while [ni < count turtles] [ ;; make edges with the next two neighbors ;; this makes a lattice with average degree of 4 let z 1 while [z <= floor (k / 2)] [ ask turtle ni [ create-link-with turtle ((ni + z) mod count turtles) ] set z z + 1 ] set ni ni + 1 ] end to setup-fc ;; Make a circle of turtles create-turtles N layout-circle turtles (max-pxcor - 1) ;; Now give each pair of turtles an equal chance ;; of creating a link ask turtles [ ;; we use "self > myself" here so that each pair of turtles ;; is only considered once create-links-with turtles with [self != myself ] ] end to setup-erdos-renyi ;; Make a circle of turtles let p (k / N) create-turtles N layout-circle turtles (max-pxcor - 1) let success? false let count-tries 0 while [ not success? ] [ ask links [ die ] ;; Now give each pair of turtles an equal chance ;; of creating a link ask turtles [ ;; we use "self > myself" here so that each pair of turtles ;; is only considered once create-links-with turtles with [self > myself and random-float 1.0 < p ] ] set success? ( item 0 identify-clusters = 1 ) set count-tries count-tries + 1 if ( count-tries > 1000 ) [ set success? true print "couldn't make connected network! try different parameters!" ] ] end ;; clusters code adapted from "Dissemination of Culture" by ??? ;; see info tab for full copyright info to-report identify-clusters let max-cluster 0 let num-clusters 0 let seed one-of turtles ask turtles [ set cluster nobody ] while [seed != nobody] [ ask seed [ set cluster self set num-clusters num-clusters + 1 set this-cluster 1 grow-cluster ] if this-cluster > max-cluster [ set max-cluster this-cluster] set seed one-of turtles with [cluster = nobody] ] report list num-clusters max-cluster end to grow-cluster ask link-neighbors with [cluster = nobody] [ if cluster = nobody [ set this-cluster this-cluster + 1 ] set cluster [cluster] of myself grow-cluster ] end
There is only one version of this model, created over 7 years ago by Network Dynamics Group.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.