# Belief Diffusion

No preview image

Model was written in NetLogo 5.0.4
•
Viewed 539 times
•
Downloaded 37 times
•
Run 0 times

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

;Nov 5, 2012: More effecient statistical outputs. First and last time of maximum truth distance, first and last ;time of convergence, mean truth distance, median truth distance. ;This version of Millian Mingling includes three different kinds of agents, millians, chums, and believers. ;Each breed of agent has a different movement rule. Believers move around randomly, millians seek out people ;they disagree with (according to a search radius set by the vision variable), and chums seek out people ;they already agree with. Agents keep a record of the recent agents they have interacted with, where this ;can be controlled by the maxhistory variable. ;new statistics, one for each breed breed [fact-checkers fact-checker] breed [believers believer] breed [millians millian] breed [chums chum] breed [afact-checkers afact-checker] patches-own [ truthflux ] globals [ truth-list false-list props-to-compare num-of-interacted-agents ; this tracks how many agents interacted num-chum-interacted num-mill-interacted num-believer-interacted num-of-attitudes-changed ; this tracks how many attitudes an agent changed in an interaction num-of-updated-attitude-agents ;this tracks how many agents updated an attitude num-of-decreased-loudness ;tracks how many decreases in loudness there were num-of-increased-loudness ;tracks how many increases in loudness there were avg-num-attitudes-changed ; avg-num-disagreements current-avg-dist-truth ;this avg includes indifference current-avg-dist-others ;this avg includes indifference current-avg-disagree-truth ; this avg ignores indifference current-avg-disagree-others ; this avg ignores indifference current-avg-millian-disagree-truth current-avg-believer-disagree-truth current-avg-chum-disagree-truth current-avg-millian-loudness current-avg-chum-loudness current-avg-believer-loudness my-seed max-truthdist-b max-truthdist-c max-truthdist-m min-truthdist-b min-truthdist-c min-truthdist-m tickof-first-max-truthdist-b tickof-first-max-truthdist-c tickof-first-max-truthdist-m tickof-last-max-truthdist-b tickof-last-max-truthdist-c tickof-last-max-truthdist-m tickof-first-min-truthdist-b tickof-first-min-truthdist-c tickof-first-min-truthdist-m tickof-last-min-truthdist-b tickof-last-min-truthdist-c tickof-last-min-truthdist-m truthdist-b truthdist-c truthdist-m median-truthdist-b median-truthdist-c median-truthdist-m mean-truthdist-b mean-truthdist-c mean-truthdist-m ] turtles-own [ old-attitude-list ; this is a list of attitudes towards propositions new-attitude-list ; this is a list of attitudes towards propositions old-loudness-list ; this is a list of how loudly an agent voices that attitude new-loudness-list ; this is a list of how loudly an agent voices that attitude meet-history ; this is a list of past agents a turtle has met with minglers ; agentset of nearby turtles nearest-mingler ; closest of one of the minglers (that isn't also in the meet-history) ] to setup clear-all ask patches [ set truthflux 0 set pcolor brown] set truthdist-b [ ] set truthdist-c [ ] set truthdist-m [ ] create-believers (num-believers - (num-millians + num-chums)) [ ; create num-believers quantity of believers setxy random-xcor random-ycor set color blue set shape "person" set old-attitude-list [ ] set old-loudness-list [ ] set meet-history [] repeat num-props [ ; create a list of beliefs and a list of loudness degrees that is of size num-props let attitude -1 if believers-facters-opposite-attitude = false[ set attitude (random 3) - 1 ] set old-attitude-list lput attitude old-attitude-list ifelse attitude = 0 [ set old-loudness-list lput 0 old-loudness-list ] [ ifelse set-init-believer-loudness-max = true [ set old-loudness-list lput init-max-believer-loudness old-loudness-list ] [ set old-loudness-list lput (random init-max-believer-loudness) old-loudness-list ] ] ] ] create-millians num-millians [ ; create num-believers quantity of believers setxy random-xcor random-ycor set color violet set shape "person" set old-attitude-list [ ] set old-loudness-list [ ] set meet-history [ ] repeat num-props [ ; create a list of beliefs and a list of loudness degrees that is of size num-props let attitude -1 if believers-facters-opposite-attitude = false[ set attitude (random 3) - 1 ] set old-attitude-list lput attitude old-attitude-list ifelse attitude = 0 [ set old-loudness-list lput 0 old-loudness-list ] [ ifelse set-init-believer-loudness-max = true [ set old-loudness-list lput init-max-believer-loudness old-loudness-list ] [ set old-loudness-list lput (random init-max-believer-loudness) old-loudness-list ] ] ] ] create-chums num-chums [ ; create num-believers quantity of believers setxy random-xcor random-ycor set color 34 set shape "person" set old-attitude-list [ ] set old-loudness-list [ ] set meet-history [ ] repeat num-props [ ; create a list of beliefs and a list of loudness degrees that is of size num-props let attitude -1 if believers-facters-opposite-attitude = false[ set attitude (random 3) - 1 ] set old-attitude-list lput attitude old-attitude-list ifelse attitude = 0 [ set old-loudness-list lput 0 old-loudness-list ] [ ifelse set-init-believer-loudness-max = true [ set old-loudness-list lput init-max-believer-loudness old-loudness-list ] [ set old-loudness-list lput (random init-max-believer-loudness) old-loudness-list ] ] ] ] set truth-list [ ] repeat num-props [ ; create a list of beliefs that is of size num-propos set truth-list lput one-of [1] truth-list ] set false-list [ ] repeat num-props [ set false-list lput one-of [-1] false-list ] create-fact-checkers num-sci [ ; create agents that will be the fact checkers setxy random-xcor random-ycor set color green set shape "tree" set old-attitude-list truth-list set old-loudness-list [] set meet-history [] ;repeat num-props [ ; create a list of loudness degrees that is of size num-props ; set old-loudness-list lput (random max-loudness) old-loudness-list ; fact-checkers have max loudness at start ;] repeat num-props [ ; create a list of loudness degrees that is of size num-props ifelse world-loudness-max = true [ ifelse plus-one-max-world-loudness = true [ set old-loudness-list lput (max-loudness + 1) old-loudness-list] [ set old-loudness-list lput max-loudness old-loudness-list ] ][ set old-loudness-list lput (random (init-max-believer-loudness + 1) ) old-loudness-list ] ] ] create-afact-checkers num-asci [ ; create agents that will be the afact checkers - i.e., those that speak falsehoods setxy random-xcor random-ycor set color red set shape "tree" set old-attitude-list false-list set old-loudness-list [] set meet-history [] ;repeat num-props [ ; create a list of loudness degrees that is of size num-props ; set old-loudness-list lput (random max-loudness) old-loudness-list ; fact-checkers have max loudness at start ;] repeat num-props [ ; create a list of loudness degrees that is of size num-props ifelse world-loudness-max = true [ ifelse plus-one-max-world-loudness = true [ set old-loudness-list lput (max-loudness + 1) old-loudness-list] [ set old-loudness-list lput max-loudness old-loudness-list ] ][ set old-loudness-list lput (random (init-max-believer-loudness + 1) ) old-loudness-list ] ] ] ask turtles[ set new-attitude-list old-attitude-list ;this copies the old list set new-loudness-list old-loudness-list ] ;;ask patches [if pxcor mod 2 = 1 and pycor mod 2 = 0 [set pcolor 1] if pxcor mod 2 = 0 and pycor mod 2 = 1 [set pcolor 1]] reset-ticks end to go set num-of-interacted-agents 0 set num-mill-interacted 0 set num-chum-interacted 0 set num-believer-interacted 0 set num-of-attitudes-changed 0 set num-of-updated-attitude-agents 0 set num-of-decreased-loudness 0 ;tracks how many decreases in loudness there were set num-of-increased-loudness 0 ask turtles [ move ] ask patches with [count turtles-here >= 2] [ ifelse patch-announcement = true [ let props pick-props-to-compare let current-prop one-of props let kate max-one-of turtles-here [item current-prop old-loudness-list] ask turtles-here with [who != [who] of kate] [ interact kate self ] ] [ let kate one-of turtles-here let john one-of turtles-here with [who != [who] of kate] interact kate john update-meet-history kate john ] ] ask turtles [ if (old-attitude-list != new-attitude-list) [ set num-of-updated-attitude-agents num-of-updated-attitude-agents + 1 ] ] ask turtles [ update-attitudes ] update-truthflux statistics tick if num-attitude-groups = 1 and mode-attitude-group = [[1]] [ set median-truthdist-b median truthdist-b set median-truthdist-c median truthdist-c set median-truthdist-m median truthdist-m set mean-truthdist-b mean truthdist-b set mean-truthdist-c mean truthdist-c set mean-truthdist-m mean truthdist-m stop ] end to interact [kate john] let kate-is-auth? false let john-is-auth? false ask kate [ ; find out if kate is a fact-checker if breed = fact-checkers or breed = afact-checkers [ set kate-is-auth? true ] ] ask john [ ; find out if john is a fact-checker if breed = fact-checkers or breed = afact-checkers [ set john-is-auth? true ] ] let props pick-props-to-compare ; we set props to the list of propositions returned by pick-props... while [not empty? props] [ ; while props is nonempty, we compare the attidudes of the turtles towards those props let current-prop first props set props but-first props if kate-is-auth? = false and john-is-auth? = false [ ;if neither agent is a fact-checker or afact-checker ifelse item current-prop [old-attitude-list] of kate != item current-prop [old-attitude-list] of john [;if they disagree if item current-prop [old-loudness-list] of kate > item current-prop [old-loudness-list] of john [;if kate is louder ifelse item current-prop [old-attitude-list] of john = 0 [;if john is at the tipping point ask john [;we ask john to switch to kate's attitude if item current-prop [old-attitude-list] of kate = 0 [user-message (word kate "shouldn't be indifferent if the code's right" )] set new-attitude-list replace-item current-prop new-attitude-list item current-prop [old-attitude-list] of kate ] ][ ask john [ ;else, we ask john to reduce his loudness if it's above 0, else we change his attitude to 0 ifelse item current-prop old-loudness-list = 0 [ set new-attitude-list replace-item current-prop new-attitude-list 0 ] [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list - 1) set num-of-decreased-loudness num-of-decreased-loudness + 1 ] ] ] ] if item current-prop [old-loudness-list] of kate < item current-prop [old-loudness-list] of john [ ifelse item current-prop [old-attitude-list] of kate = 0 [ ask kate [ if item current-prop [old-attitude-list] of john = 0 [user-message (word john "shouldn't be indifferent if the code's right" ) ] set new-attitude-list replace-item current-prop new-attitude-list item current-prop [old-attitude-list] of john ] ] [ ask kate [ ifelse item current-prop old-loudness-list = 0 [ set new-attitude-list replace-item current-prop new-attitude-list 0 ] [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list - 1) set num-of-decreased-loudness num-of-decreased-loudness + 1 ] ] ] ] ] ;else kate and john agree [ if item current-prop [old-attitude-list] of kate != 0 [ ;since john and kate agree and both aren't fact-checkers, ;we don't need to check that john's attitude is 0 as well ask kate [ if item current-prop old-loudness-list < max-loudness [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list + 1) set num-of-increased-loudness num-of-increased-loudness + 1 ] ] ask john [ if item current-prop old-loudness-list < max-loudness [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list + 1) set num-of-increased-loudness num-of-increased-loudness + 1 ] ] ] ] ];end of decisions when neither kate nor john are fact-checkers if kate-is-auth? = false and john-is-auth? = true [ ifelse item current-prop [old-attitude-list] of kate != item current-prop [old-attitude-list] of john [ if item current-prop [old-loudness-list] of kate < item current-prop [old-loudness-list] of john [ ifelse item current-prop [old-attitude-list] of kate = 0 [ if item current-prop [old-attitude-list] of john = 0 [user-message (word "john shouldn't be indifferent" ) ] ask kate [ set new-attitude-list replace-item current-prop new-attitude-list item current-prop [old-attitude-list] of john ] ] [ if item current-prop [old-attitude-list] of john = 0 [user-message (word "john shouldn't be indifferent" ) ] ask kate [ ifelse item current-prop old-loudness-list = 0 [ set new-attitude-list replace-item current-prop new-attitude-list 0 ] [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list - 1) set num-of-decreased-loudness num-of-decreased-loudness + 1 ] ] ] ] ] ;else kate and john agree and kate should get a boost since john is the fact checker [ ask kate [ if item current-prop old-loudness-list < max-loudness [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list + 1) set num-of-increased-loudness num-of-increased-loudness + 1 ] ] ] ] if kate-is-auth? = true and john-is-auth? = false [ ifelse item current-prop [old-attitude-list] of kate != item current-prop [old-attitude-list] of john [ if item current-prop [old-loudness-list] of kate > item current-prop [old-loudness-list] of john [ ifelse item current-prop [old-attitude-list] of john = 0 [ if item current-prop [old-attitude-list] of kate = 0 [user-message (word kate "shouldn't be indifferent" ) ] ask john [ set new-attitude-list replace-item current-prop new-attitude-list item current-prop [old-attitude-list] of kate ] ] [ if item current-prop [old-attitude-list] of kate = 0 [user-message (word kate "shouldn't be indifferent" ) ] ask john [ ifelse item current-prop old-loudness-list = 0 [ set new-attitude-list replace-item current-prop new-attitude-list 0 ] [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list - 1) set num-of-decreased-loudness num-of-decreased-loudness + 1 ] ] ] ] ] ;else kate and john agree and john should get a boost since kate is the fact checker [ ask john [ if item current-prop old-loudness-list < max-loudness [ set new-loudness-list replace-item current-prop new-loudness-list (item current-prop old-loudness-list + 1) set num-of-increased-loudness num-of-increased-loudness + 1 ] ] ] ] ];end of while loop for propositions to be compared update-meet-history kate john update-interacted-agents kate john end to update-truthflux let props pick-props-to-compare ; we set props to the list of propositions returned by pick-props... ifelse length props > 1 [user-message (word "This model can only handle patch updates when there's one proposition in question") ] [ let current-prop first props ask patches [ if any? turtles-here[ let tsum 0 ask turtles-here [ let att (item current-prop old-attitude-list * item current-prop old-loudness-list);;since disbelief is -1, we simply multply loudness by it to get a negative number set tsum tsum + att ] set truthflux truthflux * truth-decay + (tsum / count turtles-here) update-patch-color ] ] ] end to update-patch-color set pcolor 5 + truthflux / 10 end to update-interacted-agents [kate john] ask kate [ if breed = millians [ set num-mill-interacted num-mill-interacted + 1 ] if breed = chums [ set num-chum-interacted num-chum-interacted + 1 ] if breed = believers [ set num-believer-interacted num-believer-interacted + 1 ] ] ask john [ if breed = millians [ set num-mill-interacted num-mill-interacted + 1 ] if breed = chums [ set num-chum-interacted num-chum-interacted + 1 ] if breed = believers [ set num-believer-interacted num-believer-interacted + 1 ] ] end to update-meet-history [kate john] ask kate [ set meet-history fput [who] of john meet-history set meet-history remove-duplicates meet-history if length meet-history > maxhistory [ set meet-history but-last meet-history ] ] ask john [ set meet-history fput [who] of kate meet-history set meet-history remove-duplicates meet-history if length meet-history > maxhistory [ set meet-history but-last meet-history ] ] end to-report make-new-attitudes repeat num-props-to-compare [ ] report new-attitude-list end to update-attitudes set old-attitude-list new-attitude-list ;this turns the new list into the old one for the next tick set old-loudness-list new-loudness-list end to-report pick-props-to-compare ; this function selects propositions for comparison set props-to-compare [ ] repeat num-props-to-compare [ set props-to-compare lput random num-props props-to-compare ] report props-to-compare end to move move-millians move-believers move-chums end to find-minglers set minglers other turtles in-radius vision set minglers minglers with [not member? [who] of self [meet-history] of myself] ; set minglers minglers with [ color = blue ] end to move-millians let current-prop first pick-props-to-compare ;picks the first prop from the list returned by pick-props-to-compare ask millians [ find-minglers let opp-minglers minglers with [item current-prop old-attitude-list != item current-prop [old-attitude-list] of myself] set nearest-mingler min-one-of opp-minglers [distance myself] ifelse nearest-mingler = nobody[ rt random-float 90 - random-float 90; turtle turns x degrees to the right if positve, left if negative fd 0.1 ] [ ifelse [xcor] of nearest-mingler = [xcor] of self and [ycor] of nearest-mingler = [ycor] of self[ fd 0.1 ] [ set heading towardsxy [xcor] of nearest-mingler [ycor] of nearest-mingler fd 0.1 ] ] ] end to move-believers ask believers [ ifelse believers-search = true [ find-minglers set nearest-mingler min-one-of minglers [distance myself] ifelse nearest-mingler = nobody [ rt random-float 90 - random-float 90; turtle turns x degrees to the right if positve, left if negative fd 0.1 ; turtle moves forward by 1 step ] [ ifelse [xcor] of nearest-mingler = [xcor] of self and [ycor] of nearest-mingler = [ycor] of self[ fd 0.1 ] [ set heading towardsxy [xcor] of nearest-mingler [ycor] of nearest-mingler fd 0.1 ] ] ] [ rt random-float 90 - random-float 90; turtle turns x degrees to the right if positve, left if negative fd 0.1 ; turtle moves forward by 1 step ] ] end to move-chums let current-prop first pick-props-to-compare ;picks the first prop from the list returned by pick-props-to-compare ask chums [ find-minglers let shared-minglers minglers with [item current-prop old-attitude-list = item current-prop [old-attitude-list] of myself] set nearest-mingler min-one-of shared-minglers [distance myself] ifelse nearest-mingler = nobody[ rt random-float 90 - random-float 90; turtle turns x degrees to the right if positve, left if negative fd 0.1 ] [ ifelse [xcor] of nearest-mingler = [xcor] of self and [ycor] of nearest-mingler = [ycor] of self[ fd 0.1 ] [ set heading towardsxy [xcor] of nearest-mingler [ycor] of nearest-mingler fd 0.1 ] ] ] end ;****************************** ;****************************** ;This section is for statistics ;****************************** ;****************************** to statistics set current-avg-dist-truth avg-distance-to-truth set current-avg-dist-others avg-distance-to-others set current-avg-disagree-truth avg-disagreement-to-truth ; this avg ignores indifference set current-avg-disagree-others avg-disagreement-to-others; this avg ignores indifference set current-avg-millian-disagree-truth avg-millian-disagreement-to-truth set current-avg-believer-disagree-truth avg-believer-disagreement-to-truth set current-avg-chum-disagree-truth avg-chum-disagreement-to-truth set current-avg-millian-loudness avg-millian-loudness set current-avg-chum-loudness avg-chum-loudness set current-avg-believer-loudness avg-believer-loudness set truthdist-b fput current-avg-believer-disagree-truth truthdist-b set truthdist-c fput current-avg-chum-disagree-truth truthdist-c set truthdist-m fput current-avg-millian-disagree-truth truthdist-m truthdist-update end to truthdist-update ifelse ticks = 0 [initialize-truthdist] [ if current-avg-believer-disagree-truth > max-truthdist-b [ set max-truthdist-b current-avg-believer-disagree-truth set tickof-first-max-truthdist-b ticks set tickof-last-max-truthdist-b ticks] if current-avg-millian-disagree-truth > max-truthdist-m [ set max-truthdist-m current-avg-millian-disagree-truth set tickof-first-max-truthdist-m ticks set tickof-last-max-truthdist-m ticks ] if current-avg-chum-disagree-truth > max-truthdist-c [ set max-truthdist-c current-avg-chum-disagree-truth set tickof-first-max-truthdist-c ticks set tickof-last-max-truthdist-c ticks ] if current-avg-believer-disagree-truth = max-truthdist-b [ set tickof-last-max-truthdist-b ticks ] if current-avg-millian-disagree-truth = max-truthdist-m [ set tickof-last-max-truthdist-m ticks ] if current-avg-chum-disagree-truth = max-truthdist-c [ set tickof-last-max-truthdist-c ticks ] if current-avg-believer-disagree-truth < min-truthdist-b [ set min-truthdist-b current-avg-believer-disagree-truth set tickof-first-min-truthdist-b ticks set tickof-last-min-truthdist-b ticks] if current-avg-millian-disagree-truth < min-truthdist-m [ set min-truthdist-m current-avg-millian-disagree-truth set tickof-first-min-truthdist-m ticks set tickof-last-min-truthdist-m ticks ] if current-avg-chum-disagree-truth < min-truthdist-c [ set min-truthdist-c current-avg-chum-disagree-truth set tickof-first-min-truthdist-c ticks set tickof-last-min-truthdist-c ticks ] if current-avg-believer-disagree-truth = min-truthdist-b [ set tickof-last-min-truthdist-b ticks ] if current-avg-millian-disagree-truth = min-truthdist-m [ set tickof-last-min-truthdist-m ticks ] if current-avg-chum-disagree-truth = min-truthdist-c [ set tickof-last-min-truthdist-c ticks ] ] end to initialize-truthdist set max-truthdist-b current-avg-believer-disagree-truth set max-truthdist-c current-avg-chum-disagree-truth set max-truthdist-m current-avg-millian-disagree-truth set min-truthdist-b current-avg-believer-disagree-truth set min-truthdist-c current-avg-chum-disagree-truth set min-truthdist-m current-avg-millian-disagree-truth set tickof-first-max-truthdist-b 1 set tickof-first-max-truthdist-c 1 set tickof-first-max-truthdist-m 1 set tickof-last-max-truthdist-b 1 set tickof-last-max-truthdist-c 1 set tickof-last-max-truthdist-m 1 set tickof-first-min-truthdist-b 1 set tickof-first-min-truthdist-c 1 set tickof-first-min-truthdist-m 1 set tickof-last-min-truthdist-b 1 set tickof-last-min-truthdist-c 1 set tickof-last-min-truthdist-m 1 end to-report avg-millian-loudness let current-prop first pick-props-to-compare let loudness-sum 0 ifelse num-millians != 0 [ ask millians [ set loudness-sum loudness-sum + item current-prop new-loudness-list ] report loudness-sum / num-millians ] [ report 0] end to-report avg-chum-loudness let current-prop first pick-props-to-compare let loudness-sum 0 ifelse num-chums != 0 [ ask chums [ set loudness-sum loudness-sum + item current-prop new-loudness-list ] report loudness-sum / num-chums ] [ report 0] end to-report avg-believer-loudness let current-prop first pick-props-to-compare let loudness-sum 0 ifelse num-believers != 0 [ ask believers [ set loudness-sum loudness-sum + item current-prop new-loudness-list ] report loudness-sum / num-believers ] [ report 0] end to-report num-attitude-groups ;how many agents do not have identical attitude sets let num-groups [ ] ask turtles with [breed != fact-checkers] [ set num-groups lput new-attitude-list num-groups ] set num-groups remove-duplicates num-groups report length num-groups end to-report mode-attitude-group ; let num-groups [ ] ask turtles with [breed != fact-checkers] [ set num-groups lput new-attitude-list num-groups ] set num-groups remove-duplicates num-groups report modes num-groups end to-report avg-distance-to-truth let num-non-fc 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed != fact-checkers] [ set total-dist (total-dist + hammy-distance truth-list old-attitude-list) set num-non-fc num-non-fc + 1 ] report total-dist / num-non-fc end to-report avg-distance-to-others let num-of-comparisons 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed != fact-checkers] [ ask other turtles with [breed != fact-checkers] [ set total-dist (total-dist + hammy-distance [old-attitude-list] of myself [old-attitude-list] of self) set num-of-comparisons num-of-comparisons + 1 ] ] report total-dist / num-of-comparisons end to-report avg-disagreement-to-truth ; this distance measure ignores indifference attitudes let num-non-fc 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed != fact-checkers] [ set total-dist (total-dist + truth-distance truth-list old-attitude-list) set num-non-fc num-non-fc + 1 ] report total-dist / num-non-fc end to-report avg-millian-disagreement-to-truth ; this distance measure ignores indifference attitudes let count-millians 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed = millians] [ set total-dist (total-dist + truth-distance truth-list old-attitude-list) set count-millians count-millians + 1 ] ifelse count-millians != 0 [ report total-dist / count-millians ][ report 0] end to-report avg-chum-disagreement-to-truth ; this distance measure ignores indifference attitudes let count-chums 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed = chums] [ set total-dist (total-dist + truth-distance truth-list old-attitude-list) set count-chums count-chums + 1 ] ifelse count-chums != 0 [ report total-dist / count-chums ][ report 0] end to-report avg-believer-disagreement-to-truth ; this distance measure ignores indifference attitudes let count-believers 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed = believers] [ set total-dist (total-dist + truth-distance truth-list old-attitude-list) set count-believers count-believers + 1 ] ifelse count-believers != 0 [ report total-dist / count-believers ][report 0] end to-report avg-disagreement-to-others ; this distance measure ignores indifference attitudes let num-of-comparisons 0 ;variable for total num of fact-checkers let total-dist 0 ;variable for total distance ask turtles with [breed != fact-checkers] [ ask other turtles with [breed != fact-checkers] [ set total-dist (total-dist + truth-distance [old-attitude-list] of myself [old-attitude-list] of self) set num-of-comparisons num-of-comparisons + 1 ] ] report total-dist / num-of-comparisons end to-report hammy-distance [list1 list2] ; how many differences there are between two lists, which isn't quite the hamming distance let ham 0 foreach n-values length list1 [?] [ let item1 item ? list1 let item2 item ? list2 if item1 != item2 [ set ham ham + 1 ] ] report ham end to-report truth-distance [list1 list2] ; how many differences there are between two lists, ignoring indifference let cheese 0 foreach n-values length list1 [?] [ let item1 item ? list1 let item2 item ? list2 if item1 != 0 and item2 != 0 and item1 != item2 [ set cheese cheese + 1 ] ] report cheese end ;; Use a seed created by the NEW-SEED reporter to use-new-seed set my-seed new-seed ;; generate a new seed output-print word "Generated seed: " my-seed ;; print it out random-seed my-seed ;; use the new seed end ;; Use a seed entered by the user to use-seed-from-user set my-seed read-from-string user-input "Enter a random seed (an integer):" output-print word "User-entered seed: " my-seed ;; print it out random-seed my-seed ;; use the new seed end

There is only one version of this model, created about 11 years ago by Bert Baumgaertner.

## Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.