Newcomb communicative acts
No preview image
Model was written in NetLogo 5.0.1
•
Viewed 249 times
•
Downloaded 33 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
globals[ proportion-extremists distribution-extremists change? prev-op initial-profile ] breed [agents agent] breed [points point] ;; the points are used for visualisation only and don't affect the model's dynamics agents-own[ op ;; a list that holds the opinions of the agent extremist? ;; a binary value that is set true if the agent's opinion is in the extremism-range ] to setup clear-all reset-ticks create-agents num-agents [ set op (list) repeat num-ops [set op lput (random-float 2 - 1) op] set hidden? true ifelse (abs (item 0 op) > 1 - extremism-range) [set extremist? true][set extremist? false] ] visualise extremism-makro mk-initProfile set prev-op map [precision ? 2] reduce sentence map [[op] of ?] sort agents ;; this is important for the change-occured? reporter set change? true end to go repeat num-agents * num-ops[ ask one-of agents [update-opinion]] if ( visuals) [visualise] extremism-makro tick end to update-opinion ;;turtle procedure ;;makes the agents change their opinion values let i random num-ops let B one-of other agents let B-op [op] of B let AB attraction B-op if (AB )[ if (opinion-change = "both change half")[ let new-op (item i op + item i B-op) / 2 if (not(extremist? and i = 0) )[ set op replace-item i op (new-op) if (abs (item 0 op) > 1 - extremism-range) [set extremist? true] ] ask B [ if (not(extremist? and i = 0) )[ set op replace-item i op (new-op) if (abs (item 0 op) > 1 - extremism-range) [set extremist? true] ] ] ] if (opinion-change = "one changes complete")[ if (not(extremist? and i = 0) )[ set op replace-item i op (item i B-op) if (abs (item 0 op) > 1 - extremism-range) [set extremist? true] ] ] ] end to-report attraction [liste] ;; this reporter calculates the attraction between two agents based on the ;; average of the differences between their opinions in all opinion-dimensions let i 0 let erg 0 repeat num-ops [ set erg erg + abs(item i op - item i liste) set i i + 1 ] report erg / num-ops < eps end to visualise ;; creates the visualisation in the world window. For every opinion of every agent ;; a point is created and set to x coordinates of the world. the different dimensions are stacked to the y axis ask points [die] foreach sort agents[ let i 0 let prev 0 create-points num-ops [ set color 125 set shape "dot" if (prev != 0)[create-link-with prev] setxy ([item i op] of ? * 9) ((num-ops - i - 0.5) / num-ops) * max-pycor set i i + 1 set prev self] ] end to extremism-makro ;;calculates the output of the monitors in the interface tab set proportion-extremists count agents with [extremist?] / num-agents ifelse (proportion-extremists != 0)[ set distribution-extremists (count agents with [extremist? and item 0 op > 0] - count agents with [extremist? and item 0 op < 0]) / count agents with [extremist?] ][set distribution-extremists "NA"] end to-report change-occured? ;; this reporter reports false if no change occured for more than 1000 ticks. It is used for behaviour space experiments. if (ticks mod 1001 = 1000)[ let op-list map [precision ? 2] reduce sentence map [[op] of ?] sort agents let i 0 set change? false foreach op-list[ if (? != item i prev-op) [set change? true] set i i + 1] set prev-op op-list ] report change? end to mk-initProfile set initial-profile (list) foreach sort agents[ set initial-profile lput (map [precision ? 2][op] of ?) initial-profile repeat 5 - num-ops[set initial-profile lput "NA" initial-profile]] end to-report format ;;This reporter organizes the data for statistical analysis. let current-profile (list) foreach sort agents[set current-profile lput (map [precision ? 2][op] of ?) current-profile repeat 5 - num-ops[set current-profile lput "NA" current-profile]] set current-profile reduce sentence current-profile set initial-profile reduce sentence initial-profile report (word txt current-profile ",," txt initial-profile) end to-report txt [liste] let text "" foreach liste [set text (word text ? ",")] report text end
There is only one version of this model, created over 12 years ago by Hannes Bruns.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.