extensions [ time ] breed [ persons person ] globals [ ;; global input parameters not manipulated via the interface run-number sensitivity-batch? csv-separator is-batch? n-sal max-sal min-sal WC WO WNPV WP WS WE IDW bgmin bgmax run-group witnesses SRANGE SMDBA min-wealth median-wealth max-wealth total-wealth ;; variables for bookkeeping startdate real-startdate stopdate no-theft-after no-alms-after time-of-last-alms-or-theft event-counter length-moving-average n-of-thefts n-of-alms n-of-detected-cases n-of-punishments n-of-granted-alms percentage-of-granted-alms percentage-of-detected-cases percentage-of-punishments time-of-last-completed-theft counter alms-counter theft-counter unexecuted-thefts current-seed run-type ;; global variables only used to signal events or quantities between procedures event-database ;; this a list of lists containing 9 items: with the following keys to list items: i-type ;; either "theft" or "alms" i-count ;; counter for identifying events i-offender ;; either the thief or the recipient of alms i-victim ;; either the agent from which something is stolen or the almsgiver i-amount ;; the value of the theft or of the alms i-stolen-at ;; the time when the theft happened or the alms was begged i-detected-at ;; the time when the theft was detected (empty for alms) i-punished-at ;; the time when the theft was punished (empty for alms) i-granted-at ;; the time when the alms was given (empty for theft) NULL ;; global variables kept only for technical purposes world-too-small? ERROR-OCCURRED? message-id interface-filename logfile-name database-name history-name distribution-name axis-identifier ;; means and standard deviations of norm saliences all-norms all-norm-types all-means all-sds all-actions invocation-count ] ;; the event board common to all agent types persons-own [ state days-passed action-planned? my-home wealth role my-wealth-position my-thief last-message-id my-norms my-norm-saliences my-compliances my-violations my-theft-propensity my-help-propensity my-begging-propensity my-punishing-propensity other-compliances other-violations punishments sanctions explicit-compliance-invocations explicit-violations individual-drive normative-drive my-last-theft my-last-loss my-last-alms-request ] patches-own [ ] ;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Setup Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;; to setup ;; (for this model to work with NetLogo's new plotting features, ;; __clear-all-and-reset-ticks should be replaced with clear-all at ;; the beginning of your setup procedure and reset-ticks at the end ;; of the procedure.) clear-all clear-output set sensitivity-batch? false set is-batch? false set startdate time:create "1200/01/01 00:00" reset-ticks set event-counter 0 ;; set saliences-and-propensities [] set message-id 0 set world-too-small? false let initial-agents initial-persons if initial-agents > world-width * world-height [ let new-size ceiling sqrt initial-agents let new-patchsize patch-size * ( world-width / new-size ) show ( word behaviorspace-run-number " The world is too small for " initial-agents " agents." ) show "Edit the view, keep in mind that " show "if you enlarge the world, " show "you should adapt the patch-size." show "Set max-pxcor and max-pycor to" show ( word ( new-size - 1 ) " and patch-size to" ) show new-patchsize set world-too-small? true stop ] set event-database ( list ( list "type" "count" "offender" "victim" "amount" "stolen-at" "detected-at" "punished_at" "granted_at" ) ) set i-type 0 set i-count 1 set i-offender 2 set i-victim 3 set i-amount 4 set i-stolen-at 5 set i-detected-at 6 set i-punished-at 7 set i-granted-at 8 set NULL "" set all-actions ( list "STEAL" "HELP" "BEG" "PUNISH" ) set all-norms ( list "NORM: THOU SHALT NOT STEAL" "NORM: PROPERTY IS THEFT" "NORM: GIVE ALMS" "NORM: FOOD ONLY FOR WORK" ) set all-norm-types ( list "MOSES" "PROUDHON" "MOSES" "PROUDHON" ) set all-means n-values length all-norms [ 0 ] set all-sds all-means set max-sal (-1) set min-sal (2) let run-identifier ( word "000" behaviorspace-run-number ) set real-startdate date-and-time set run-identifier substring ( run-identifier ) ( length ( run-identifier ) - 4 ) length ( run-identifier ) set run-number run-identifier set run-identifier ( word rectify-date "_" run-identifier ) set interface-filename ( word "result_" run-identifier ".png" ) set logfile-name ( word "logfile_" run-identifier ".txt" ) set database-name ( word "database_" run-identifier ".csv" ) set history-name ( word "history_" run-identifier ".csv" ) set distribution-name ( word "distribution_" run-identifier ".csv" ) set axis-identifier ( word "saliences_" ) set SRANGE ( word RANGE ) if length SRANGE = 1 [ set SRANGE ( word "0" SRANGE ) ] set SMDBA ( word MAX-DAYS-BETWEEN-ACTIONS ) if length SMDBA = 1 [ set SMDBA ( word "0" SMDBA ) ] set csv-separator ";" ifelse file-exists? history-name [ file-open history-name ] [ file-open history-name file-type "behaviorspace_run_number" file-type csv-separator file-type "run_type" file-type csv-separator file-type "run_group" file-type csv-separator file-type "ticks" file-type csv-separator file-type "simulated_time" file-type csv-separator file-type "current_seed" file-type csv-separator file-type "real_time" file-type csv-separator file-type "real_time_since" file-type csv-separator file-type "background" file-type csv-separator file-type "norm_weight" file-type csv-separator file-type "locality" file-type csv-separator file-type "discount_rate" file-type csv-separator file-type "n_of_thefts" file-type csv-separator file-type "n_of_alms" file-type csv-separator file-type "percentage_of_detected_cases" file-type csv-separator file-type "percentage_of_punishments" file-type csv-separator file-print "percentage_of_granted_alms" ] file-close file-open distribution-name file-type "run" file-type "," file-type "LISTENERS" file-type "," file-type "RANGE" file-type "," file-type "NDW" file-type "," file-type "MAX-DAYS-BETWEEN-ACTIONS" file-type "," file-type "ticks" file-type "," file-type "ID" file-type "," file-type "weight" file-type "," file-type "theft propensity" file-type "," file-type "help propensity" file-type "," file-type "punishing propensity" file-type "," file-type "begging propensity" file-type "," file-type "anti-theft norm salience" file-type "," file-type "anti-property norm-salience" file-type "," file-type "pro alms norm-salience" file-type "," file-type "anti alms norm-salience" file-type "," file-print "wealth" file-close set ERROR-OCCURRED? false ;; these are only for the norm-version, initialisation for searching the parameter space of this model are planned but not yet implemented set WC 0.99 set WO 0.33 set WNPV 0.66 set WP 0.33 set WS 0.99 set WE 0.99 set IDW 1 - NDW set constant-random-seed? false set export-interface? false set csv-separator "," set no-theft-after TNOW set no-alms-after TNOW set time-of-last-alms-or-theft TNOW show ( word behaviorspace-run-number " setup: " no-theft-after " " no-alms-after " " time-of-last-alms-or-theft " " TNOW ) set counter 0 set alms-counter 0 set theft-counter 0 set unexecuted-thefts 0 set invocation-count ( list ( list 0 ( list 0 0 0 0 0 0 0 0 ) ) ( list 1 ( list 0 0 0 0 0 0 0 0 ) ) ( list 2 ( list 0 0 0 0 0 0 0 0 ) ) ( list 3 ( list 0 0 0 0 0 0 0 0 ) ) ) show behaviorspace-run-number ifelse behaviorspace-run-number = 0 [ util-standard-settings set is-batch? false ] [ util-batch-settings set is-batch? true set log-level -10 set current-seed new-seed random-seed current-seed show ( word behaviorspace-run-number " calling populate ...." ) ] tick show ( word behaviorspace-run-number " populate starting for " initial-persons ) set stopdate time:plus startdate max-weeks "weeks" ;; this serves to search the parameter space of this version if sensitivity-batch? [ set constant-random-seed? false set current-seed new-seed random-seed current-seed ;; the following input parameters are initialised randomly for subsequent runs: set NDW random-float-in-range 0.3 0.7 set IDW 1 - NDW set DISCOUNT random-float-in-range 0.8 1.0 set LISTENERS random-float-in-range 2 10 set BACKGROUND random-float-in-range bgmin bgmax ] ;; If set to ON, the random seed has the same value in every run. Here it is set to 4711. if constant-random-seed? [ set current-seed 4711 random-seed current-seed ] show ( word behaviorspace-run-number " random seed is " current-seed ) create-persons initial-persons [ persons-setup ] set witnesses n-of N-WITNESSES persons show ( word behaviorspace-run-number " populate created " count persons " persons." ) set-normative-predispositions end ;; setup procedures for the different agent types follow to persons-setup set color white set shape "person" set size 0.8 set state "unspecified" set wealth ( random-beta 2 6 ) * 1800 + 200 set my-home one-of patches with [ not any? other turtles-here ] ifelse my-home = nobody [ show ( word behaviorspace-run-number " no home patch found." ) set ERROR-OCCURRED? true stop ] [ move-to my-home ] set last-message-id 0 set my-norms all-norms set my-norm-saliences n-values length my-norms [ 0.0 ] set my-compliances n-values length my-norms [ 0 ] set my-violations n-values length my-norms [ 0 ] set my-theft-propensity 0 set my-help-propensity 0 set my-begging-propensity 0 set my-punishing-propensity 0 set other-compliances n-values length my-norms [ 0 ] set other-violations n-values length my-norms [ 0 ] set punishments n-values length my-norms [ 0 ] set sanctions n-values length my-norms [ 0 ] set explicit-compliance-invocations n-values length my-norms [ 0 ] set explicit-violations n-values length my-norms [ 0 ] set action-planned? false end to set-normative-predispositions let LNP BACKGROUND let TNP 10 ifelse LNP < 0 [ set LNP 0 set TNP 0 - BACKGROUND ] [ set TNP 0 ] ask ( persons ) [ let my-norm-compliance-dispositions [] let my-norm-violation-dispositions [] foreach my-norms [ let np position ? all-norms if item np all-norm-types = "MOSES" [ set my-norm-compliance-dispositions lput LNP my-norm-compliance-dispositions set my-norm-violation-dispositions lput TNP my-norm-violation-dispositions ] if item np all-norm-types = "PROUDHON" [ set my-norm-compliance-dispositions lput TNP my-norm-compliance-dispositions set my-norm-violation-dispositions lput LNP my-norm-violation-dispositions ] ] set my-compliances my-norm-compliance-dispositions set my-violations my-norm-violation-dispositions set other-compliances my-norm-compliance-dispositions set other-violations my-norm-violation-dispositions set punishments my-norm-violation-dispositions set sanctions my-norm-violation-dispositions set explicit-compliance-invocations my-norm-compliance-dispositions set explicit-violations my-norm-violation-dispositions ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Runtime Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; to go-eventwise if world-too-small? [ stop ] time:clear-schedule time:anchor-schedule startdate 1 "hour" time-schedule-event "observer" task daily-routine "daily-routine" ( time:plus startdate 6 "hours" ) ;; show time:show-schedule util-flog 5 ( word "after initialising persons at " T TNOW " the calendar length is " time:size-of-schedule ) time-schedule-event "observer" task [ prepare-output update-plots ] "prepare-output update-plots" ( time:plus startdate 1 "day" ) set event-counter event-counter + 1 if time:size-of-schedule > 0 [ time:go-until stopdate ] if behaviorspace-run-number = 0 [ prepare-final-output ] end to-report end-of-next-month let stoptime time:plus TNOW 1.0 "month" if time:is-after stoptime stopdate [ set stoptime stopdate ] report stoptime end to time-schedule-event [ executor a-task a-task-name a-time ] set event-counter event-counter + 1 ;; show ( word behaviorspace-run-number " time-schedule-event for " a-time " at " TNOW ) if time:is-equal a-time TNOW [ stop ] if time:is-between a-time startdate TNOW [ stop ] ifelse time:is-between a-time TNOW stopdate [ time:schedule-event executor a-task a-time util-flog 2 ( word "; " executor "; " a-task-name "; " a-task "; " T a-time ) ] [ ;; show ( word a-time " not scheduled between " TNOW " and " stopdate ) stop ] end to-report color-code [ ratio ] let this-item ceiling ( ratio * 8 ) report item this-item ( list 15 25 45 65 85 105 115 125 125 ) end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; PROCEDURES REGULATING PERIODIC EVENTS ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to daily-routine set median-wealth median [ wealth ] of persons set min-wealth min [ wealth ] of persons set max-wealth max [ wealth ] of persons set total-wealth sum [ wealth ] of persons let sort-wealth sort [ wealth ] of persons ask persons [ let my-rank position wealth sort-wealth set my-theft-propensity propensity-to "STEAL" set my-help-propensity propensity-to "HELP" set my-begging-propensity propensity-to "BEG" set my-punishing-propensity propensity-to "PUNISH" set my-wealth-position my-rank / length [ wealth ] of persons let my-est-err-help-propensity my-help-propensity - ( 0.615 - 0.221 * my-theft-propensity ) if show-feature = "wealth" [ set color color-code my-wealth-position ] if show-feature = "cluster" [ ifelse my-theft-propensity < 0.58 [ set color 35 ][ set color 115 ] if my-est-err-help-propensity < -0.1 [ set color color - 10 ] if my-est-err-help-propensity > 0.1 [ set color color + 10 ] ] if show-feature = "role" [ if state = "thief" [ set color red + days-passed ] if state = "theft victim" [ set color cyan + days-passed ] if state = "punisher" [ set color green + days-passed ] if state = "beggar" [ set color yellow + days-passed ] if state = "almsgviver" [ set color blue + days-passed ] if state = "stingy" [ set color magenta + days-passed ] if state = "unspecified" [ set color grey ] ] if RADIUS > 0 [ let next-patch one-of patches in-radius RADIUS with [ not any? other turtles-here ] ifelse next-patch = nobody [ show ( word behaviorspace-run-number " no home patch found." ) set ERROR-OCCURRED? true stop ] [ move-to next-patch ] ] let propensity-to-take-action random-float 1.0 let i'll-do-nothing propensity-to-take-action > my-begging-propensity and propensity-to-take-action > my-theft-propensity let i'll-steal false let i'll-beg false ifelse action-planned? [ set i'll-do-nothing true ] [ set i'll-steal propensity-to-take-action < my-theft-propensity set i'll-beg propensity-to-take-action < my-begging-propensity ] if i'll-steal and i'll-beg [ let propensity-to-steal random-float ( my-theft-propensity + my-begging-propensity ) ifelse propensity-to-steal < my-theft-propensity [ set i'll-steal true set i'll-beg false ] [ set i'll-steal false set i'll-beg true ] ] util-flog 12 ( word propensity-to-take-action " compared to MTP = " my-theft-propensity " and to MBP = " my-begging-propensity " N:" i'll-do-nothing ", S:" i'll-steal ", B:" i'll-beg ", WP: " my-wealth-position ) let time-span-till-my-next-action ( random MAX-DAYS-BETWEEN-ACTIONS ) + ( random-float 0.5 ) if i'll-beg and not i'll-do-nothing and not i'll-steal [ time-schedule-event self task ask-for-alms "BEG" ( time:plus TNOW time-span-till-my-next-action "day" ) set action-planned? true update-compliances "NORM: THOU SHALT NOT STEAL" update-violations "NORM: FOOD ONLY FOR WORK" ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: THOU SHALT NOT STEAL" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: FOOD ONLY FOR WORK" ] ] if i'll-steal and not i'll-do-nothing and not i'll-beg [ time-schedule-event self task try-and-steal "STEAL" ( time:plus TNOW time-span-till-my-next-action "day" ) set action-planned? true update-compliances "NORM: FOOD ONLY FOR WORK" update-violations "NORM: THOU SHALT NOT STEAL" ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: FOOD ONLY FOR WORK" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: THOU SHALT NOT STEAL" ] ] if i'll-do-nothing [ if days-passed < 4 [ set days-passed days-passed + 0.4 ] update-compliances "NORM: THOU SHALT NOT STEAL" update-compliances "NORM: FOOD ONLY FOR WORK" update-violations "NORM: PROPERTY IS THEFT" update-violations "NORM: GIVE ALMS" ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: THOU SHALT NOT STEAL" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: FOOD ONLY FOR WORK" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: PROPERTY IS THEFT" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: GIVE ALMS" ] ] ] if DTS? and not is-batch? [ output-distribution ] time-schedule-event "observer" task daily-routine "daily-routine" ( time:plus TNOW 1 "day" ) end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; PROCEDURES USED BY PERSONS ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to ask-for-alms let my-wealth wealth let my-patron one-of persons in-radius RANGE with [ wealth > 2 * my-wealth ] let almsrecipient self set action-planned? false if my-patron != nobody [ set state "beggar" set days-passed 0 set counter counter + 1 set alms-counter alms-counter + 1 let this-counter counter let probability-to-get-alms 0 ask my-patron [ set probability-to-get-alms propensity-to "HELP" ] ifelse random-float 1 < probability-to-get-alms [ time-schedule-event my-patron task [ grant-alms almsrecipient this-counter ] ( word "grant alms to " almsrecipient ", request #: " counter ) ( time:plus TNOW random-float 0.1 "day" ) ] [ ask my-patron [ set state "stingy" set days-passed 0 ] update-violations "NORM: GIVE ALMS" update-compliances "NORM: FOOD ONLY FOR WORK" ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: GIVE ALMS" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: FOOD ONLY FOR WORK" ] ] add-entry "alms" counter self my-patron NULL ( T TNOW ) NULL NULL NULL ] end to grant-alms [ recipient request-count ] let my-wealth wealth let alms-value 0.03 * my-wealth util-flog 5 ( word " grants " alms-value " to " recipient " at " T TNOW ) set wealth wealth - alms-value ask recipient [ set wealth wealth + alms-value ] set state "almsgiver" set days-passed 0 update-compliances "NORM: GIVE ALMS" update-violations "NORM: FOOD ONLY FOR WORK" ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: GIVE ALMS" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: FOOD ONLY FOR WORK" ] util-flog 5 ( word " grants " precision alms-value 2 " to " recipient " at " T TNOW ", request count " request-count ) change-entry request-count recipient self i-granted-at T TNOW change-amount request-count recipient self i-amount alms-value end to try-and-steal let wealth-position my-wealth-position let my-state state let my-victim one-of persons in-radius RANGE with [ my-wealth-position > wealth-position ] set action-planned? false ifelse my-victim != nobody [ set counter counter + 1 set theft-counter theft-counter + 1 let stolen-amount 0.05 * [ wealth ] of my-victim ask my-victim [ set wealth wealth - stolen-amount set my-last-loss counter set state "theft victim" set days-passed 0 set my-state "thief" ] set my-last-theft counter set state my-state set days-passed 0 set wealth wealth + stolen-amount update-compliances "NORM: PROPERTY IS THEFT" update-violations "NORM: THOU SHALT NOT STEAL" ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances "NORM: PROPERTY IS THEFT" ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations "NORM: THOU SHALT NOT STEAL" ] ask my-victim [ time-schedule-event my-victim task [ search-my-thief ] ( word "search my thief " ) ( time:plus TNOW random-float-in-range 0 5 "days" ) ] add-entry "steal" counter self my-victim stolen-amount ( T TNOW ) NULL NULL NULL ] [ update-violations "NORM: PROPERTY IS THEFT" update-compliances "NORM: THOU SHALT NOT STEAL" util-flog 2 ( word "didn't find a victim for planned theft, my wealth = " wealth ", neighbours' wealth: " sort [ wealth ] of persons in-radius RANGE ) set unexecuted-thefts unexecuted-thefts + 1 ] end to search-my-thief let wealth-position my-wealth-position let my-wealth wealth let theft-victim self let my-state state let potential-thieves persons in-radius RANGE with [ my-wealth-position < wealth-position ] let my-presumptive-thief thief-in-entry my-last-loss let my-last-loss-amount amount-in-entry my-last-loss ifelse member? my-presumptive-thief potential-thieves [ set message-id message-id + 1 set my-thief my-presumptive-thief let his-wealth [ wealth ] of my-thief let compensation 0.4 * his-wealth if compensation > ( 2.0 * my-last-loss-amount ) [ set compensation ( 2.0 * my-last-loss-amount ) ] let this-theft my-last-loss change-entry this-theft my-thief self i-detected-at T TNOW ask my-thief [ if random-float 1 < my-punishing-propensity [ set my-state "punisher" set days-passed 0 change-entry this-theft self theft-victim i-punished-at T TNOW set my-wealth my-wealth + compensation set wealth wealth - compensation ] update-punishments "NORM: THOU SHALT NOT STEAL" 0 self message-id ] set wealth my-wealth set state my-state update-observed-violations "NORM: THOU SHALT NOT STEAL" ] [ util-flog 5 ( word "presumptive thief " my-presumptive-thief " is not among potential thieves " potential-thieves ) set my-thief nobody ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; PROCEDURES USED BY ALL TYPES OF AGENTS ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; all kinds of agents calculate the salience of one norm when they need to make a decision which relates to this norm ;; they use these salience to calculate action propensities to-report propensity-to [ action ] if not member? action all-actions [ util-flog 5 ( word "propensity-to: " action " is not a valid action." ) set ERROR-OCCURRED? true report -1 ] if member? self witnesses [ show ( word ": C: " MP my-compliances " V: " MP my-violations " OC: " MP other-compliances " OV: " MP other-violations " P: " MP punishments " S: " MP sanctions " EC: " MP explicit-compliance-invocations " EV: " MP explicit-violations " SAL: " MP my-norm-saliences ) ] calculate-my-individual-drive-to action calculate-my-normative-drive-to action let a-prop ( IDW * individual-drive + NDW * normative-drive ) if a-prop > 1 or a-prop < 0 [ util-flog (-2) ( word "ERROR: a-prop out of bounds: " a-prop " = " IDW "*" individual-drive " + " NDW "*" normative-drive ) ] if member? self witnesses [ show ( word ": ID = " individual-drive ", NF = " normative-drive ", propensity to " action " = " a-prop ) ] report a-prop end to-report MP [ value-list ] report map [ precision ? 1 ] value-list end to calculate-my-normative-drive-to [ action ] if not member? action all-actions [ util-flog 0 ( word "calculate-my-normative-drive-to: " action " is not a valid action." ) set ERROR-OCCURRED? true stop ] if action = "STEAL" [ calculate-a-salience "NORM: THOU SHALT NOT STEAL" calculate-a-salience "NORM: PROPERTY IS THEFT" let np-dont position "NORM: THOU SHALT NOT STEAL" my-norms let np-do position "NORM: PROPERTY IS THEFT" my-norms let normative-drive-to-steal item np-do my-norm-saliences let normative-drive-not-to-steal item np-dont my-norm-saliences ifelse normative-drive-to-steal > normative-drive-not-to-steal [ set normative-drive normative-drive-to-steal ] [ set normative-drive 1 - normative-drive-not-to-steal ] ] if action = "PUNISH" [ calculate-a-salience "NORM: THOU SHALT NOT STEAL" calculate-a-salience "NORM: PROPERTY IS THEFT" let np-do position "NORM: THOU SHALT NOT STEAL" my-norms let np-dont position "NORM: PROPERTY IS THEFT" my-norms let normative-drive-to-steal item np-do my-norm-saliences let normative-drive-not-to-steal item np-dont my-norm-saliences ifelse normative-drive-to-steal > normative-drive-not-to-steal [ set normative-drive normative-drive-to-steal ] [ set normative-drive 1 - normative-drive-not-to-steal ] ] if action = "HELP" or action = "BEG" [ calculate-a-salience "NORM: GIVE ALMS" calculate-a-salience "NORM: FOOD ONLY FOR WORK" let np-dont position "NORM: FOOD ONLY FOR WORK" my-norms let np-do position "NORM: GIVE ALMS" my-norms let normative-drive-to-help item np-do my-norm-saliences let normative-drive-refuse-help item np-dont my-norm-saliences ifelse normative-drive-to-help > normative-drive-refuse-help [ set normative-drive normative-drive-to-help ] [ set normative-drive 1 - normative-drive-refuse-help ] ] end to-report arctan [ argument ] report 1 - ( atan 1 argument ) / 180 end to calculate-my-individual-drive-to [ action ] if not member? action all-actions [ util-flog 0 ( word "calculate-my-individual-drive-to: " action " is not a valid action." ) set ERROR-OCCURRED? true stop ] let my-neighbours min-n-of LISTENERS persons [ distance myself ] let n-of-my-neighbours count my-neighbours let my-relative-wealth-position position wealth sort [ wealth ] of my-neighbours / n-of-my-neighbours if action = "STEAL" or action = "BEG" [ set individual-drive ( 1 - my-wealth-position ) ] if action = "HELP" [ set individual-drive my-wealth-position ] if action = "PUNISH" [ set individual-drive my-wealth-position ] end to calculate-a-salience [ a-norm ] if not member? a-norm all-norms [ util-flog 0 ( word "calculate-a-salience: " a-norm " is not a valid norm." ) set ERROR-OCCURRED? true stop ] let np position a-norm my-norms let C item np my-compliances let V item np my-violations let OC item np other-compliances let OV item np other-violations let P item np punishments let S item np sanctions let EC item np explicit-compliance-invocations let EV item np explicit-violations let numerator 0 let denominator 0 let OWN 0 if C + V > 0 [ set OWN ( C - V ) / ( C + V ) ] set numerator numerator + WC set denominator denominator + 2 * WC let OBS 0 if OC + OV > 0 [ set OBS ( OC - OV ) / ( OC + OV ) ] set numerator numerator + WO set denominator denominator + 2 * WO let NPV 0 if OV + V > 0 [ set NPV (OV + V - P - S ) if NPV < 0 [ set NPV 0 ] set NPV NPV / ( OV + V) ] set numerator numerator + WNPV set denominator denominator + WNPV let maxPSOV P + S if OV + V > P + S [ set maxPSOV OV + V ] let P_max 0 if maxPSOV > 0 [ set P_max P / maxPSOV ] set denominator denominator + WP let S_max 0 if maxPSOV > 0 [ set S_max S / maxPSOV ] set denominator denominator + WS let ECEV 0 if EC + EV > 0 [ set ECEV ( EC - EV ) / ( EC + EV ) ] set numerator numerator + WE set denominator denominator + 2 * WE let SAL 0 if denominator > 0 [ set SAL ( ( numerator + OWN * WC + OBS * WO - NPV * WNPV + P_max * WP + S_max * WS + ECEV * WE ) / denominator ) ] if member? self witnesses [ show ( word ": salience of " a-norm " calculated as " SAL ) ] set my-norm-saliences replace-item np my-norm-saliences SAL set n-sal n-sal + 1 if SAL < min-sal [ set min-sal SAL ] if SAL > max-sal [ set max-sal SAL ] end ;; all kinds of agents update their individual event board to increase-invocation-counter [ i-item a-norm ] util-flog 10 ( word i-item " for " a-norm ) util-flog 10 invocation-count let this-norm position a-norm all-norms let this-sublist item this-norm invocation-count let this-subsublist item 1 this-sublist let this-entry item i-item this-subsublist set this-subsublist replace-item i-item this-subsublist ( this-entry + 1 ) set this-sublist replace-item 1 this-sublist this-subsublist set invocation-count replace-item this-norm invocation-count this-sublist util-flog 10 invocation-count end to update-compliances [ a-norm ] increase-invocation-counter 0 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np my-compliances set my-compliances replace-item np my-compliances ( old-value * DISCOUNT + 1 ) ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-compliances a-norm ] end to update-violations [ a-norm ] increase-invocation-counter 1 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np my-violations set my-violations replace-item np my-violations ( old-value * DISCOUNT + 1 ) ] ask min-n-of LISTENERS persons [ distance myself ] [ update-observed-violations a-norm ] end to update-observed-compliances [ a-norm ] increase-invocation-counter 2 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np other-compliances set other-compliances replace-item np other-compliances ( old-value * DISCOUNT + 1 ) ] end to update-observed-violations [ a-norm ] increase-invocation-counter 3 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np other-violations set other-violations replace-item np other-violations ( old-value * DISCOUNT + 1 ) ] end to update-punishments [ a-norm depth caller id ] if id = last-message-id [ if member? self witnesses [ show ( word behaviorspace-run-number " UP: message id " id " already dealt with." ) ] stop ] increase-invocation-counter 4 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np punishments set punishments replace-item np punishments ( old-value * DISCOUNT + 1 ) ] if depth = 0 [ ask min-n-of LISTENERS persons [ distance myself ] [ if member? a-norm my-norms [ update-punishments a-norm 1 myself message-id update-explicit-compliance-invocations a-norm 1 myself message-id ] ] ] set last-message-id id end to update-sanctions [ a-norm depth caller id ] if id = last-message-id [ if member? self witnesses [ show ( word behaviorspace-run-number " US: message id " id " already dealt with." ) ] stop ] increase-invocation-counter 5 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np sanctions set sanctions replace-item np sanctions ( old-value * DISCOUNT + 1 ) ] if depth = 0 [ ask min-n-of LISTENERS persons [ distance myself ] [ if member? a-norm my-norms [ update-sanctions a-norm 1 myself message-id update-explicit-compliance-invocations a-norm 1 myself message-id ] ] ] set last-message-id id end to update-explicit-compliance-invocations [ a-norm depth caller id ] ;; if id = last-message-id ;; [ ;; if member? self witnesses [ show ( word behaviorspace-run-number " UECI: message id " a-norm " " depth " " caller " " id " already dealt with." ) ] ;; stop ;; ] increase-invocation-counter 6 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np explicit-compliance-invocations set explicit-compliance-invocations replace-item np explicit-compliance-invocations ( old-value * DISCOUNT + 1 ) ] if depth = 0 [ ask min-n-of LISTENERS persons [ distance myself ] [ if member? a-norm my-norms [ update-sanctions a-norm 1 myself message-id update-explicit-compliance-invocations a-norm 1 myself message-id ] ] ] set last-message-id id end to update-explicit-violations [ a-norm depth caller id ] if id = last-message-id [ if member? self witnesses [ show ( word behaviorspace-run-number " UEV: message id " id " already dealt with." ) ] stop ] increase-invocation-counter 7 a-norm if member? a-norm my-norms [ let np position a-norm my-norms let old-value item np explicit-violations set explicit-violations replace-item np explicit-violations ( old-value * DISCOUNT + 1 ) ] if depth = 0 [ let addressees ( min-n-of LISTENERS persons [ distance myself ] ) with [ member? a-norm my-norms ] ask addressees [ if member? a-norm my-norms [ update-sanctions a-norm 1 myself message-id update-explicit-violations a-norm 1 myself message-id ] ] ] set last-message-id id end ;;;;;;;;;;;;;; ;; ;; Utilities ;; ;;;;;;;;;;;;;; to prepare-output ;; the following counts take only the past length-moving-average (or less) periods into account set length-moving-average 1440 let relevant-length length-moving-average if relevant-length > ticks [ set relevant-length ticks ] set relevant-length relevant-length / 24 / 7 let relevant-thefts filter [ time:difference-between ( item i-stolen-at ? ) no-theft-after "hours" < length-moving-average and ( item i-type ? ) = "steal" ] but-first event-database let relevant-almsbegging filter [ time:difference-between ( item i-stolen-at ? ) no-alms-after "hours" < length-moving-average and (item i-type ? ) = "alms" ] but-first event-database set n-of-thefts length relevant-thefts / relevant-length set n-of-alms length relevant-almsbegging / relevant-length util-flog 5 ( word "at " TNOW " " n-of-thefts " before " no-theft-after ) util-flog 5 ( word "at " TNOW " " n-of-alms " before " no-alms-after ) set n-of-detected-cases length filter [ item i-detected-at ? != NULL ] relevant-thefts / relevant-length set n-of-punishments length filter [ item i-punished-at ? != NULL ] relevant-thefts / relevant-length set n-of-granted-alms length filter [ item i-granted-at ? != NULL ] relevant-almsbegging / relevant-length if n-of-thefts > 0 [ set percentage-of-detected-cases n-of-detected-cases * 100 / n-of-thefts set percentage-of-punishments n-of-punishments * 100 / n-of-thefts ] if n-of-alms > 0 [ set percentage-of-granted-alms n-of-granted-alms * 100 / n-of-alms ] file-open history-name file-type behaviorspace-run-number file-type csv-separator file-type run-type file-type csv-separator file-type run-group file-type csv-separator file-type round ( ticks / 24 ) file-type csv-separator file-type T TNOW file-type csv-separator file-type current-seed file-type csv-separator file-type rectify-date file-type csv-separator file-type seconds-since-startdate file-type csv-separator file-type BACKGROUND file-type csv-separator file-type NDW file-type csv-separator file-type LISTENERS file-type csv-separator file-type DISCOUNT file-type csv-separator file-type n-of-thefts file-type csv-separator file-type n-of-alms file-type csv-separator file-type percentage-of-detected-cases file-type csv-separator file-type percentage-of-punishments file-type csv-separator file-print percentage-of-granted-alms file-flush time-schedule-event "observer" task [ prepare-output update-plots ] "prepare-output update-plots" ( time:plus TNOW 1 "day" ) end to prepare-final-output let all-n n-values length all-norms [ 0 ] let all-sum all-n let all-sqsum all-n ask persons [ foreach all-norms [ let this-norm ? let np 0 if member? this-norm my-norms [ set np position this-norm all-norms let old-value item np all-n set all-n replace-item np all-n ( 1 + old-value ) set old-value item np all-sum let my-np position this-norm my-norms let new-value item my-np my-norm-saliences set all-sum replace-item np all-sum ( new-value + old-value ) set old-value item np all-sqsum set all-sqsum replace-item np all-sqsum ( new-value * new-value + old-value ) ] ] ] foreach all-norms [ let np position ? all-norms let this-n item np all-n if this-n > 0 [ set all-means replace-item np all-means ( ( item np all-sum ) / this-n ) set all-sds replace-item np all-sds ( ( item np all-sqsum ) / this-n - ( item np all-means ) * ( item np all-means ) ) ] ] if export-interface? and behaviorspace-run-number = 0 [ export-interface interface-filename util-flog 5 word "interface exported to " interface-filename ] file-close output-distribution if not is-batch? [ file-open database-name foreach event-database ;; "type" "count" "offender" "victim" "amount" "stolen-at" "detected-at" "punished_at" "granted-at" ) ) [ file-type item 0 ? ;; type file-type csv-separator file-type item 1 ? ;; count file-type csv-separator file-type item 2 ? ;; beggar or thief file-type csv-separator file-type item 3 ? ;; theft victim or almsgiver file-type csv-separator file-type item 4 ? ;; amount file-type csv-separator file-type item 5 ? ;; stolen or begged at file-type csv-separator file-type item 6 ? ;; theft detected at file-type csv-separator file-type item 7 ? ;; theft punished at file-type csv-separator file-print item 8 ? ;; alms granted at ] show word "theft database exported to " database-name file-close ] end to output-distribution file-open distribution-name ask persons [ file-type ( word axis-identifier LISTENERS "_" SRANGE "_" ( 100 * NDW ) "_" SMDBA "_" run-number ) file-type "," file-type LISTENERS file-type "," file-type RANGE file-type "," file-type NDW file-type "," file-type MAX-DAYS-BETWEEN-ACTIONS file-type "," file-type ticks file-type "," file-type who file-type "," file-type 1.0 file-type "," file-type my-theft-propensity file-type "," file-type my-help-propensity file-type "," file-type my-punishing-propensity file-type "," file-type my-begging-propensity file-type "," file-type item 0 my-norm-saliences file-type "," file-type item 1 my-norm-saliences file-type "," file-type item 2 my-norm-saliences file-type "," file-type item 3 my-norm-saliences file-type "," file-print wealth ] show ( word behaviorspace-run-number " " round ticks " file " distribution-name " written." ) file-close end to-report random-float-in-range [ low high ] report low + random-float ( high - low ) end to-report random-beta [ p q ] let gamma1 random-gamma p 1 let gamma2 random-gamma q 1 let result gamma1 / ( gamma1 + gamma2 ) report result end to-report percentile [ percent variable ] let len length variable if len = 0 [ report 0 ] let var sort variable let pct round ( percent * len ) ifelse percent = 1 [ report last var ] [ ifelse percent = 0 [ report first var ] [ report item pct var ] ] end to-report sqr [ x ] report x * x end to-report rectify-day let date-string date-and-time let colon position ":" date-string set date-string replace-item colon date-string "-" set colon position ":" date-string set date-string replace-item colon date-string "-" set colon position "." date-string set date-string replace-item colon date-string "-" let year substring date-string 23 27 let month substring date-string 19 22 if month = "Okt" [ set month "Oct" ] if month = "Dez" [ set month "Dec" ] if month = "Mär" [ set month "Mar" ] if month = "Mai" [ set month "May" ] let day substring date-string 16 18 let AMPM substring date-string 13 15 let hour substring date-string 0 2 let minsec substring date-string 2 12 let month-number ( 1 + ( position month ( list "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" ) ) ) ifelse month-number < 10 [ set month ( word "0" month-number ) ] [ set month ( word month-number ) ] let num-hour read-from-string hour if AMPM = "PM" [ set hour ( word ( num-hour + 12 ) ) ] set date-string ( word year "-" month "-" day ) report date-string end to-report rectify-date let date-string date-and-time let year substring date-string 23 27 let month substring date-string 19 22 if month = "Okt" [ set month "Oct" ] if month = "Dez" [ set month "Dec" ] if month = "Mär" [ set month "Mar" ] if month = "Mai" [ set month "May" ] let day substring date-string 16 18 let AMPM substring date-string 13 15 let hour substring date-string 0 2 let mmin substring date-string 3 5 let sec substring date-string 6 8 let msec substring date-string 9 12 let month-number ( 1 + ( position month ( list "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" ) ) ) ifelse month-number < 10 [ set month ( word "0" month-number ) ] [ set month ( word month-number ) ] let num-hour read-from-string hour let num-min read-from-string mmin let num-sec read-from-string sec let time-of-day ( num-sec + 60 * num-min + 3600 * num-hour ) / 3600 if AMPM = "PM" and time-of-day < 12 [ set hour ( word ( num-hour + 12 ) ) ] set date-string ( word year "-" month "-" day "-" hour "-" mmin "-" sec "-" msec ) report date-string end to-report seconds-since-startdate let start-day substring real-startdate 16 18 let AMPM substring real-startdate 13 15 let hour substring real-startdate 0 2 let mmin substring real-startdate 3 5 let sec substring real-startdate 6 12 let num-hour read-from-string hour let num-min read-from-string mmin let num-sec read-from-string sec let start-time ( num-sec + 60 * num-min + 3600 * num-hour ) / 3600 let current-time date-and-time set AMPM substring current-time 13 15 set hour substring current-time 0 2 set mmin substring current-time 3 5 set sec substring current-time 6 12 set num-hour read-from-string hour set num-min read-from-string mmin set num-sec read-from-string sec let current-seconds ( num-sec + 60 * num-min + 3600 * num-hour ) / 3600 if start-day < substring current-time 16 18 [ set current-seconds current-seconds + 24 ] report ( ( current-seconds - start-time ) * 3600 ) end to-report entry-found [ an-extorter victim ] let result list 0 0 let possible-entries sort-by [ item 3 ?1 > item 3 ?2 ] filter [ item 0 ? = an-extorter and item 1 ? = victim ] event-database if not empty? possible-entries [ let first-attempt item 2 first possible-entries let current-attempt item 3 first possible-entries set result list first-attempt current-attempt ] report result end to add-entry [ a-type a-count an-offender a-victim an-amount a-stolen-at a-detected-at a-punished-at a-granted-at ] let new-entry ( list a-type a-count an-offender a-victim an-amount a-stolen-at a-detected-at a-punished-at a-granted-at ) if not member? a-type ( list "steal" "alms" ) [ util-flog 5 ( word "add-entry: " a-type " is no valid type." ) set ERROR-OCCURRED? true stop ] if a-type = "steal" [ set no-theft-after TNOW set time-of-last-alms-or-theft no-theft-after ] if a-type = "alms" [ set no-alms-after TNOW set time-of-last-alms-or-theft no-theft-after ] set event-database lput new-entry event-database end to change-entry [ a-counter a-thief-or-beggar a-victim key a-logotime ] util-flog 5 ( word "trying to change entry " a-counter " for " a-thief-or-beggar " " a-victim " key: " key ) let applicable-entries filter [ item i-count ? = a-counter and item i-offender ? = a-thief-or-beggar and item i-victim ? = a-victim ] event-database util-flog 5 ( word "applicable entries: " applicable-entries ) ifelse length applicable-entries > 0 [ let entry-to-replace first sort-by [ time:is-after ( item i-stolen-at ?1 ) ( item i-stolen-at ?2 ) ] applicable-entries let entry-key position entry-to-replace event-database set entry-to-replace replace-item key entry-to-replace T a-logotime set event-database replace-item entry-key event-database entry-to-replace util-flog 5 ( word "changing entry " a-counter " was successful. " ) ] [ util-flog 0 ( word "ERROR: " a-thief-or-beggar " " a-victim " " key " " a-logotime ) set ERROR-OCCURRED? true ] end to-report thief-in-entry [ a-counter ] let the-thief-in-entry nobody let applicable-entries filter [ item i-count ? = a-counter ] event-database ifelse length applicable-entries = 1 [ set the-thief-in-entry item i-offender one-of applicable-entries ] [ set ERROR-OCCURRED? true util-flog 0 ( word "no or multiple potential thieves found: " applicable-entries ) ] report the-thief-in-entry end to-report amount-in-entry [ a-counter ] let the-amount-in-entry 0 let applicable-entries filter [ item i-count ? = a-counter ] event-database ifelse length applicable-entries = 1 [ set the-amount-in-entry item i-amount one-of applicable-entries ] [ set ERROR-OCCURRED? true util-flog 0 ( word "no or multiple potential thieves found: " applicable-entries ) ] report the-amount-in-entry end to change-amount [ a-counter a-beggar an-almsgiver key an-amount ] util-flog 5 ( word "trying to change entry " a-counter " for " a-beggar " " an-almsgiver " key: " key ) let applicable-entries filter [ item i-count ? = a-counter and item i-type ? = "alms" and item i-offender ? = a-beggar and item i-victim ? = an-almsgiver ] event-database ifelse length applicable-entries > 0 [ let entry-to-replace first sort-by [ time:is-after ( item i-stolen-at ?1 ) ( item i-stolen-at ?2 ) ] applicable-entries let entry-key position entry-to-replace event-database set entry-to-replace replace-item key entry-to-replace an-amount set event-database replace-item entry-key event-database entry-to-replace util-flog 5 ( word "changing entry " a-counter " was successful. " ) ] [ util-flog 0 ( word "ERROR: " a-beggar " " an-almsgiver " " key " " an-amount ) util-flog 5 event-database set ERROR-OCCURRED? true ] end to-report TNOW ifelse ticks = 0 [ report startdate ] [ report time:plus startdate ticks "hours" ] end to-report T [ a-logotime ] ifelse a-logotime = NULL or a-logotime = 0 [ report a-logotime ] [ report time:show a-logotime "yyyy-MM-dd HH:mm:ss" ] end to util-flog [ level something ] file-open logfile-name if level < log-level [ file-show ( word TNOW "; " level "; " something ) ] file-flush end to util-standard-settings set sensitivity-batch? false end to util-batch-settings set max-weeks 13 set constant-random-seed? false if member? "sensitivity" behaviorspace-experiment-name [ set sensitivity-batch? true set bgmin (-20) set bgmax 20 ] end @#$#@#$#@ GRAPHICS-WINDOW 200 10 848 679 -1 -1 10.633333333333333 1 8 1 1 1 0 0 0 1 0 59 0 59 1 1 1 ticks 30.0 BUTTON 105 10 182 46 go go-eventwise NIL 1 T OBSERVER NIL NIL NIL NIL 0 SWITCH 10 390 175 423 constant-random-seed? constant-random-seed? 1 1 -1000 TEXTBOX 25 55 85 73 World 11 0.0 1 SLIDER 10 75 180 108 initial-persons initial-persons 0 4800 1200 200 1 NIL HORIZONTAL SWITCH 10 425 175 458 export-interface? export-interface? 1 1 -1000 SLIDER 10 285 182 318 DISCOUNT DISCOUNT 0 1 0.95 0.1 1 NIL HORIZONTAL SLIDER 10 110 182 143 LISTENERS LISTENERS 0 30 17 1 1 NIL HORIZONTAL SLIDER 10 215 182 248 NDW NDW 0 1 0.8 0.05 1 NIL HORIZONTAL MONITOR 10 725 130 770 Messages exchanged message-id 17 1 11 PLOT 855 55 1015 175 Thou shalt not steal NIL NIL 0.0 10.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 0.05 1 -16777216 true "" "histogram [ item 0 my-norm-saliences ] of persons" MONITOR 130 725 245 770 n-sal min-sal max-sal ( list n-sal precision min-sal 3 precision max-sal 3 ) 17 1 11 SLIDER 10 250 182 283 BACKGROUND BACKGROUND -100 100 0 0.1 1 NIL HORIZONTAL PLOT 1655 175 1815 295 steal NIL NIL 0.0 1.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 0.05 1 -16777216 true "" "histogram [ my-theft-propensity ] of persons" PLOT 855 175 1015 295 Property is theft NIL NIL 0.0 10.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ item 1 my-norm-saliences ] of persons" TEXTBOX 880 10 1025 28 Action related saliences 11 0.0 1 TEXTBOX 235 415 320 451 action \npropensity 11 0.0 1 MONITOR 1230 10 1370 55 Time time:show time:plus startdate ticks \"hours\" \"yyyy-MM-dd HH:mm:ss\" 17 1 11 SLIDER 10 520 102 553 log-level log-level -5 10 -10 1 1 NIL HORIZONTAL MONITOR 1380 10 1517 55 NIL T no-theft-after 17 1 11 TEXTBOX 15 370 85 388 Run controls 11 0.0 1 MONITOR 10 680 130 725 pending events time:size-of-schedule 17 1 11 PLOT 1185 535 1345 655 Thefts months % week 0.0 1.0 0.0 1.0 true false "" "" PENS "detected" 1.0 0 -8630108 true "" "plotxy ( ticks / 730.5 ) percentage-of-detected-cases" "punishded" 1.0 0 -13840069 true "" "plotxy ( ticks / 730.5 ) percentage-of-punishments" SLIDER 10 460 175 493 max-weeks max-weeks 0 104 13 1 1 NIL HORIZONTAL PLOT 1345 535 1575 655 Thefts per week months NIL 0.0 1.0 0.0 1.0 true true "" "" PENS "dark" 1.0 0 -16777216 true "" "if ticks > 168 [ plotxy ( ticks / 730.5 ) n-of-thefts - n-of-detected-cases ]" "detected" 1.0 0 -8630108 true "" "if ticks > 168 [ plotxy ( ticks / 730.5 ) n-of-detected-cases ]" "all" 1.0 0 -7500403 true "" "if ticks > 168 [ plotxy ( ticks / 730.5 ) n-of-thefts ]" "punished" 1.0 0 -13840069 true "" "if ticks > 168 [ plotxy ( ticks / 730.5 ) n-of-punishments ]" MONITOR 130 680 245 725 all events event-counter 0 1 11 BUTTON 15 10 100 46 NIL setup NIL 1 T OBSERVER NIL NIL NIL NIL 1 MONITOR 340 775 442 820 thefts precision n-of-thefts 2 17 1 11 MONITOR 440 775 525 820 detections precision n-of-detected-cases 2 17 1 11 PLOT 855 295 1015 415 Give alms NIL NIL 0.0 10.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ item 2 my-norm-saliences ] of persons" PLOT 855 415 1015 535 Food only for work NIL NIL 0.0 10.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ item 3 my-norm-saliences ] of persons" PLOT 1655 415 1815 535 help NIL NIL 0.0 10.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ my-help-propensity ] of persons" MONITOR 635 775 735 820 alms begged precision n-of-alms 2 17 1 11 MONITOR 342 685 847 730 thefts or alms begged (total) counter 17 1 11 PLOT 1345 655 1575 775 Alms per week NIL NIL 0.0 1.0 0.0 10.0 true true "" "" PENS "begged" 1.0 0 -7500403 true "" "if ticks > 168 [ plotxy ( ticks / 730.5 ) n-of-alms ]" "granted" 1.0 0 -2674135 true "" "if ticks > 168 [ plotxy ( ticks / 730.5 ) n-of-granted-alms ]" PLOT 1185 655 1345 775 Alms months % week 0.0 1.0 0.0 10.0 true false "" "" PENS "granted" 1.0 0 -2674135 true "" "plotxy ( ticks / 730.5 ) percentage-of-granted-alms" MONITOR 737 775 842 820 alms granted precision n-of-granted-alms 2 17 1 11 PLOT 1015 625 1175 775 Wealth NIL NIL 0.0 1.0 0.0 10.0 true false "" "" PENS "median" 1.0 0 -16777216 true "" "plotxy ( ticks / 730.5 ) median-wealth" "min" 1.0 0 -7500403 true "" "plotxy ( ticks / 730.5 ) min-wealth" "max" 1.0 0 -7500403 true "" "plotxy ( ticks / 730.5 ) max-wealth" "pen-3" 1.0 0 -2674135 true "" "plotxy ( ticks / 730.5 ) percentile 0.5 [ wealth ] of persons" "pen-4" 1.0 0 -955883 true "" "plotxy ( ticks / 730.5 ) percentile 0.25 [ wealth ] of persons" "pen-5" 1.0 0 -955883 true "" "plotxy ( ticks / 730.5 ) percentile 0.75 [ wealth ] of persons" "pen-6" 1.0 0 -6459832 true "" "plotxy ( ticks / 730.5 ) percentile 0.125 [ wealth ] of persons" "pen-7" 1.0 0 -6459832 true "" "plotxy ( ticks / 730.5 ) percentile 0.375 [ wealth ] of persons" "pen-8" 1.0 0 -6459832 true "" "plotxy ( ticks / 730.5 ) percentile 0.625 [ wealth ] of persons" "pen-9" 1.0 0 -6459832 true "" "plotxy ( ticks / 730.5 ) percentile 0.875 [ wealth ] of persons" MONITOR 855 580 935 625 Wealth total-wealth 0 1 11 PLOT 1655 295 1815 415 beg NIL NIL 0.0 10.0 0.0 10.0 true false "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" "" PENS "default" 1.0 0 -16777216 true "" "histogram [ my-begging-propensity ] of persons" PLOT 855 625 1015 775 Wealth distribution Wealth NIL 0.0 2000.0 0.0 1.0 true false "set-plot-pen-mode 1\nset-plot-pen-color black" "let low 0\nif length [ wealth ] of persons > 3 [ set low min [ wealth ] of persons ]\nlet high 1\nif length [ wealth ] of persons > 3 [ set high 1.05 * max [ wealth ] of persons ]\nif high = low [ set high low + 0.1 set low low - 0.1 ]\nset low precision low 2\nset high precision high 2\nset-plot-x-range low high \nset-plot-pen-interval ( high - low + 0.01 ) / 20" PENS "default" 1.0 0 -16777216 true "" "histogram [ wealth ] of persons" MONITOR 1520 10 1655 55 NIL T no-alms-after 17 1 11 PLOT 1495 175 1655 295 steal x help S H 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy my-theft-propensity my-help-propensity\n plot-pen-up\n]" PLOT 1335 175 1495 295 steal x beg S B 0.0 1.0 0.0 1.0 false false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy my-theft-propensity my-begging-propensity\n plot-pen-up\n]" PLOT 1175 55 1335 175 punish x steal P S 0.0 1.0 0.0 1.0 false false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy my-punishing-propensity my-theft-propensity\n plot-pen-up\n]" PLOT 1495 295 1655 415 beg x help B H 0.0 1.0 0.0 1.0 false false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy my-begging-propensity my-help-propensity\n plot-pen-up\n]" PLOT 1335 55 1495 175 punish x beg P B 0.0 1.0 0.0 1.0 false false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy my-punishing-propensity my-begging-propensity \n plot-pen-up\n]" PLOT 1495 55 1655 175 punish x help P H 0.0 1.0 0.0 1.0 false false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy my-punishing-propensity my-help-propensity \n plot-pen-up\n]" MONITOR 855 780 1815 825 invocation-count (Thou shalt not steal / Property is theft / Give alms / Food only for work // C / V / OC / OV / P / S / ECI / EVI ) invocation-count 17 1 11 PLOT 1655 55 1815 175 punish NIL NIL 0.0 10.0 0.0 10.0 true false "" "set-plot-pen-mode 1\nset-plot-x-range 0.0 1.05\nset-plot-pen-color black\nset-plot-pen-interval 0.05\nset-plot-y-range 0 10" PENS "default" 1.0 0 -16777216 true "" "histogram [ my-punishing-propensity ] of persons" MONITOR 525 775 635 820 thefts punished precision n-of-punishments 2 17 1 11 TEXTBOX 300 700 450 718 total 12 0.0 1 TEXTBOX 270 790 330 808 per week\n 12 0.0 1 TEXTBOX 1675 10 1825 28 Action propensities 12 0.0 1 PLOT 1015 175 1175 295 Prop-theft x not steal PiT TsnS 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy item 1 my-norm-saliences item 0 my-norm-saliences\n plot-pen-up\n]" PLOT 1015 295 1175 415 Alms x not steal GA TsnS 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy item 2 my-norm-saliences item 0 my-norm-saliences\n plot-pen-up\n]" PLOT 1175 295 1335 415 Alms x prop-theft GA PiT 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy item 2 my-norm-saliences item 1 my-norm-saliences\n plot-pen-up\n]" PLOT 1015 415 1175 535 Food x not steal FofW TsnS 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy item 3 my-norm-saliences item 0 my-norm-saliences\n plot-pen-up\n]" PLOT 1175 415 1335 535 Food x prop-theft FofW PiT 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy item 3 my-norm-saliences item 1 my-norm-saliences\n plot-pen-up\n]" PLOT 1335 415 1495 535 Food x alms FofW GA 0.0 1.0 0.0 1.0 true false "" "" PENS "default" 1.0 0 -16777216 true "" "plot-pen-reset\nset-plot-pen-mode 2\nask persons\n[ plot-pen-down\n set-plot-pen-color color\n plotxy item 3 my-norm-saliences item 2 my-norm-saliences\n plot-pen-up\n]" SLIDER 10 145 182 178 RANGE RANGE 0 30 16 1 1 NIL HORIZONTAL CHOOSER 10 555 148 600 show-feature show-feature "wealth" "cluster" "role" 2 MONITOR 340 730 435 775 thefts theft-counter 17 1 11 MONITOR 640 730 845 775 alms alms-counter 17 1 11 TEXTBOX 295 740 325 758 total 12 0.0 1 PLOT 1575 535 1815 775 All thefts and alms NIL Thefts and alms begged 0.0 1.0 0.0 10.0 true false "" "" PENS "default" 1.0 0 -2674135 true "" "plotxy ( ticks / 730.5 ) theft-counter" "pen-1" 1.0 0 -1184463 true "" "plotxy ( ticks / 730.5 ) alms-counter" SLIDER 10 180 182 213 RADIUS RADIUS 0 10 0 1 1 NIL HORIZONTAL MONITOR 445 730 532 775 unexecuted unexecuted-thefts 17 1 11 SLIDER 10 600 182 633 N-WITNESSES N-WITNESSES 0 5 0 1 1 NIL HORIZONTAL SLIDER 10 320 180 353 MAX-DAYS-BETWEEN-ACTIONS MAX-DAYS-BETWEEN-ACTIONS 0 42 10 1 1 NIL HORIZONTAL SWITCH 10 635 113 668 DTS? DTS? 0 1 -1000 @#$#@#$#@ ## WHAT IS IT? This model is an attempt at modelling the emergence of several norms from criticism uttered by agents which feel offended by theft and by begging for alms. It uses some but not all of the features described by Luis Gustavo Nardin, Giulia Andrighetto, Rosaria Conte, Mario Paolucci in their IntERS model (http://www.gloders.eu/images/Deliverables/GLODERS_D3-1.pdf) and most features described by Klaus G. Troitzsch in his EONOERS model (http://ccl.northwestern.edu/netlogo/models/community/EONOERS). This means that the agents representing the human actors follow emerging norms and calculate the salience of these norms according to the number of invocations of these emerging norms they receive from others. ## HOW IT WORKS **Normative board** Agents have a normative board, which can store critical remarks and retaliations from other agents which felt offended by theft or begging alms but also from those agents which retaliated theft or refused to give alms, and a mechanism with which they can remember such utterances (invocations of norms which are about to emerge), and they can calculate the salience of the respective emerging norms as a means to decide which of their possible actions they will apply in a given situation. This works as follows: * Events such as theft, alms-begging, refusal of alms or theft punishment trigger messages to agents in the neighbourhood. Each of these messages contains a reference to an emerging norm (usually the norm or norms which is or are followed or violated by the action). A recipient of such a message updates those of its memory entries which refer to the specified emerging norm according to whether the action is performed by itself or by another agent and whether the message contains a punishment or a sanction. This is implemented in a series of `update-` procedures (the `update-` procedures combine the invocation and the updates). * The calculation of an action probability consists of two steps: the individual drive to steal or to beg is determined by the relative position on the wealth rank list of all agents (the poorer the agent the higher the drive). Likewise the indivdual drive to punish theft or to give or refuse alms is also determined by this rank, but the other way round (the richer the agent the higher the drive to help or to punish). The normative drive depends on former experience with an agent's own actions and on observations made of normative behaviour of other agents' in the neighbourhood (see http://www.gloders.eu/images/Deliverables/GLODERS_D3-1.pdf, pp. 33-39). * When an agent has to choose between different action options (including the option of doing nothing) it calculates a probability (`calculate-propensity-from` for actions controlled by only one norm, and `propensity-to` for actions controlled by two conflicting norms) for each of the action options which in turn depends on a rationally calculated "individual drive" (implemented in the procedure `calculate-my-individual-drive-to` with respect to the action named as the procedure's argument) and a "normative drive" which is calculated from the salience of the norm or norms involved in the action option. The salience of the norm, in turn, is calculated according to a complicated formula (implemented in the procedure `calculate-my-normative-drive-to`) which combines the memory of * cases when this agent abided by the respective norm or violated it, * cases when this agent observed norm compliances and violations in its neighbourhood, * cases when this agent received punishments or sanctions and * cases when this agent heard about, applied or personally received invocations of the respective norm. The **"logic of action"** mentioned above can be described as follows: Immediately after the initialisation all persons are scheduled to decide whether they are going to steal or to beg alms at 06:00 of the first day (and to repeat this action after a uniformly distributed delay whose maximum duration can be changed with the slider `MAX-DAYS-BETWEEN-ACTIONS` --- currently there are no weekends) ## HOW TO USE IT Change all the sliders and switches that you want to change and press `setup`. The model will run for `max-months` simulated months (and can only be stopped with the help of `Tools`->`Halt`). The two groups of plots show what their headlines suggest. The last column of plots at the top right corner contains histograms of action propensities, the two triangular blocks in the middle show the correlations of action propensities (above the diagonal) and of norm saliences (below the diagonal). The diagrams below these scatterplots show the wealth distribution as a histogram changing over time and as a plot of the deciles of this distribution over time, The plots in the lower right corder show how many thefts and begging acts occur over time (moving averages and totals). The calculation of action propensities consists of two steps: the individual drive of agents to steal or to ask for alms is determined by their individual ranks on the wealth variable. The individual drive of agents to punish thieves or to give or refuse alms is also determined by this rank (the richer the greater the propensity to give and to punish theft, the smaller the propensity to refuse). The normative drive depends on former experience with an agent's own actions and on observations made of normative behaviour of other agents' in the neighbourhood (see http://www.gloders.eu/images/Deliverables/GLODERS_D3-1.pdf, pp. 33-39). The following sliders control global variables: * `LISTENERS` defines how many nearest neighbours of an agents are aware of its actions. * `RANGE` defines the maximmum distance within which an agent will steal or ask for alms. * `RADIUS` is the distance whithin which agents can move per day. * `NDW` is the weight of the normative drive for calculating the decision probability, the sum of the two weights for individual drive and normative drive is 1.0 * `DISCOUNT` determines the weight of older memory contents (whenever a new event arrives, the number of all previous events is multiplied by `DISCOUNT` before 1 is added for the current event; thus with `DISCOUNT = 1.0` all events have the same weight inependent of their age. * `BACKGROUND` defines the state of the memories of the agents at the time of initialisation; if this is 0, all memories are empty at the beginning, if it is positive, all agents' memories are filled with `BACKGROUND` anti-theft norm-invocations, if it is negative, they are filled with the same number of pro-theft (or: no-private-property) norm-invocations. * `MAX-DAYS-BETWEEN-ACTIONS` defines how often agents will take actions (see below). ## THINGS TO NOTICE The model keeps a database of all theft and begging events and writes files for analysis. The model calculates the main parameters of the norm salience distributions (mean and standard deviation). ## THINGS TO DISCUSS The formula for calculating salience could be simplified. As weighting coefficients are multiples of 0.33 one could replace them with the respective multiples of 1.0 and change the `numerator` and the `denominator` accordingly. The formula is claimed in Deliverable 3.1 to have been extracted from Cialdini, R. B., Kallgren, C. A., Reno, R. R. (1990). A focus theory of normative conduct: A theoretical refinement and reevaluation of the role of norms in human behavior. Advances in Experimental Social Psychology. 24: 201–234. But it seems that only the terms used in this formula were extracted from this source (which does not say anything about the weights). ## THINGS TO TRY The model can be used to find out which of the input parameters guiding the behaviour of the agents have the greatest impact on the various output parameters (see the reference cited at the end of this description). A few experiments are provided in the behavior space. ## EXTENDING THE MODEL The model could be extended by endowing the agents with even more learning capabilities. Agents could then optimise their behaviour as a reaction on punishment and sanctions. ## NETLOGO FEATURES Nothing special. The code uses recursive functions to determine to which family an extorter belongs and to write up the hierarchy in the output window. This version makes use of the time extension (which needs to be present either in the directory where the model resides or in the `extensions` directory of the NetLogo installation; perhaps the model runs only in NetLogo 5!). The initial wealth distribution is a beta distribution (converted from NetLogo's gamma function). ## RELATED MODELS This model uses some of the features of models of the GLODERS project: * http://ccl.northwestern.edu/netlogo/models/community/ARDERS is a period oriented version with constant action probabilities for all agent-types * http://ccl.northwestern.edu/netlogo/models/community/NOERS is a period oriented version with norm oriented behaviour of all agent types, much like in this version * http://ccl.northwestern.edu/netlogo/models/community/EONOERS is an event oriented version with norm oriented behaviour of all agent types, much like in this version ## CREDITS AND REFERENCES The research leading to the features adopted from the GLODERS project has received funding from the European Union Seventh Framework Programme (FP7/2007--2013) under grant agreement no. 315874 ([Global dynamics of extortion racket systems, GLODERS](http://www.gloders.eu)). These results reflect only the author’s views, and the European Union is not liable for any use that may be made of the information contained therein. The author thanks his colleagues in this and earlier projects for fruitful discussions over many years. The model owes a lot to the Nardin et al. discussion paper and to the discussions within the GLODERS project. The GLODERS project used earlier versions of this model as a proof of concept and a quick and dirty prototype of the final GLODERS simulator. This model is described in more detail in Klaus G. Troitzsch: Can lawlike rules emerge without the intervention of legislators? (submitted to Frontiers in Evolutionary Sociology and Biosociology), ## HOW TO CITE Cite this model with the URL http://ccl.northwestern.edu/netlogo/models/community/TheftNorm ## COPYRIGHT NOTICE Written by Klaus G. Troitzsch 2013-2016. The model may be used and extended if the source is quoted and a note is sent to klaus.g.troitzsch@bluewin.ch. @#$#@#$#@ default true 0 Polygon -7500403 true true 150 0 60 270 150 225 240 270 airplane true 0 Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 arrow true 0 Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 bird false 0 Polygon -7500403 true true 135 165 90 270 120 300 180 300 210 270 165 165 Rectangle -7500403 true true 120 105 180 237 Polygon -7500403 true true 135 105 120 75 105 45 121 6 167 8 207 25 257 46 180 75 165 105 Circle -16777216 true false 128 21 42 Polygon -7500403 true true 163 116 194 92 212 86 230 86 250 90 265 98 279 111 290 126 296 143 298 158 298 166 296 183 286 204 272 219 259 227 235 240 241 223 250 207 251 192 245 180 232 168 216 162 200 162 186 166 175 173 171 180 Polygon -7500403 true true 137 116 106 92 88 86 70 86 50 90 35 98 21 111 10 126 4 143 2 158 2 166 4 183 14 204 28 219 41 227 65 240 59 223 50 207 49 192 55 180 68 168 84 162 100 162 114 166 125 173 129 180 box false 0 Polygon -7500403 true true 150 285 285 225 285 75 150 135 Polygon -7500403 true true 150 135 15 75 150 15 285 75 Polygon -7500403 true true 15 75 15 225 150 285 150 135 Line -16777216 false 150 285 150 135 Line -16777216 false 150 135 15 75 Line -16777216 false 150 135 285 75 bug true 0 Circle -7500403 true true 96 182 108 Circle -7500403 true true 110 127 80 Circle -7500403 true true 110 75 80 Line -7500403 true 150 100 80 30 Line -7500403 true 150 100 220 30 butterfly true 0 Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 Circle -16777216 true false 135 90 30 Line -16777216 false 150 105 195 60 Line -16777216 false 150 105 105 60 car false 0 Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 Circle -16777216 true false 180 180 90 Circle -16777216 true false 30 180 90 Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 Circle -7500403 true true 47 195 58 Circle -7500403 true true 195 195 58 church false 0 Polygon -7500403 true true 105 15 75 285 105 285 135 285 Rectangle -7500403 true true 120 180 225 285 Rectangle -7500403 true true 120 180 225 285 Rectangle -7500403 true true 120 180 225 285 circle false 0 Circle -7500403 true true 0 0 300 circle 2 false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 cow false 0 Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 Polygon -7500403 true true 73 210 86 251 62 249 48 208 Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 cylinder false 0 Circle -7500403 true true 0 0 300 dot false 0 Circle -7500403 true true 90 90 120 face happy false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 face neutral false 0 Circle -7500403 true true 8 7 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Rectangle -16777216 true false 60 195 240 225 face sad false 0 Circle -7500403 true true 8 8 285 Circle -16777216 true false 60 75 60 Circle -16777216 true false 180 75 60 Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 fish false 0 Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 Circle -16777216 true false 215 106 30 flag false 0 Rectangle -7500403 true true 60 15 75 300 Polygon -7500403 true true 90 150 270 90 90 30 Line -7500403 true 75 135 90 135 Line -7500403 true 75 45 90 45 flower false 0 Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 Circle -7500403 true true 85 132 38 Circle -7500403 true true 130 147 38 Circle -7500403 true true 192 85 38 Circle -7500403 true true 85 40 38 Circle -7500403 true true 177 40 38 Circle -7500403 true true 177 132 38 Circle -7500403 true true 70 85 38 Circle -7500403 true true 130 25 38 Circle -7500403 true true 96 51 108 Circle -16777216 true false 113 68 74 Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 house false 0 Rectangle -7500403 true true 45 120 255 285 Rectangle -16777216 true false 120 210 180 285 Polygon -7500403 true true 15 120 150 15 285 120 Line -16777216 false 30 120 270 120 leaf false 0 Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 line true 0 Line -7500403 true 150 0 150 300 line half true 0 Line -7500403 true 150 0 150 150 pentagon false 0 Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 person false 0 Circle -7500403 true true 110 5 80 Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 Rectangle -7500403 true true 127 79 172 94 Polygon -7500403 true true 195 90 240 150 225 180 165 105 Polygon -7500403 true true 105 90 60 150 75 180 135 105 plant false 0 Rectangle -7500403 true true 135 90 165 300 Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 police false 0 Circle -7500403 false true 45 45 210 Polygon -7500403 true true 96 225 150 60 206 224 63 120 236 120 Polygon -7500403 true true 120 120 195 120 180 180 180 185 113 183 Polygon -7500403 false true 30 15 0 45 15 60 30 90 30 105 15 165 3 209 3 225 15 255 60 270 75 270 99 256 105 270 120 285 150 300 180 285 195 270 203 256 240 270 255 270 285 255 294 225 294 210 285 165 270 105 270 90 285 60 300 45 270 15 225 30 210 30 150 15 90 30 75 30 square false 0 Rectangle -7500403 true true 30 30 270 270 square 2 false 0 Rectangle -7500403 true true 30 30 270 270 Rectangle -16777216 true false 60 60 240 240 star false 0 Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 target false 0 Circle -7500403 true true 0 0 300 Circle -16777216 true false 30 30 240 Circle -7500403 true true 60 60 180 Circle -16777216 true false 90 90 120 Circle -7500403 true true 120 120 60 top-down-triangle false 0 Polygon -7500403 true true 150 270 285 45 15 45 tree false 0 Circle -7500403 true true 118 3 94 Rectangle -6459832 true false 120 195 180 300 Circle -7500403 true true 65 21 108 Circle -7500403 true true 116 41 127 Circle -7500403 true true 45 90 120 Circle -7500403 true true 104 74 152 triangle false 0 Polygon -7500403 true true 150 30 15 255 285 255 triangle 2 false 0 Polygon -7500403 true true 150 30 15 255 285 255 Polygon -16777216 true false 151 99 225 223 75 224 truck false 0 Rectangle -7500403 true true 4 45 195 187 Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 Rectangle -1 true false 195 60 195 105 Polygon -16777216 true false 238 112 252 141 219 141 218 112 Circle -16777216 true false 234 174 42 Rectangle -7500403 true true 181 185 214 194 Circle -16777216 true false 144 174 42 Circle -16777216 true false 24 174 42 Circle -7500403 false true 24 174 42 Circle -7500403 false true 144 174 42 Circle -7500403 false true 234 174 42 turtle true 0 Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 wheel false 0 Circle -7500403 true true 3 3 294 Circle -16777216 true false 30 30 240 Line -7500403 true 150 285 150 15 Line -7500403 true 15 150 285 150 Circle -7500403 true true 120 120 60 Line -7500403 true 216 40 79 269 Line -7500403 true 40 84 269 221 Line -7500403 true 40 216 269 79 Line -7500403 true 84 40 221 269 x false 0 Polygon -7500403 true true 270 75 225 30 30 225 75 270 Polygon -7500403 true true 30 75 75 30 270 225 225 270 @#$#@#$#@ NetLogo 5.3.1 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@ setup go-eventwise prepare-final-output time:is-equal TNOW stopdate mean [ wealth ] of persons setup go-eventwise prepare-final-output time:is-equal TNOW stopdate mean [ wealth ] of persons setup go-eventwise prepare-final-output time:is-equal TNOW stopdate mean [ wealth ] of persons setup go-eventwise prepare-final-output time:is-equal TNOW stopdate mean [ wealth ] of persons T no-theft-after T no-alms-after @#$#@#$#@ @#$#@#$#@ default 0.0 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 arc 0.5 -0.2 0 0.0 1.0 0.0 1 1.0 0.0 0.2 0 0.0 1.0 link direction true 0 Line -7500403 true 150 150 90 180 Line -7500403 true 150 150 210 180 my-arc 1.0 -0.2 1 4.0 4.0 0.0 1 1.0 0.0 0.2 1 4.0 4.0 link direction true 0 Polygon -7500403 true true 150 150 120 195 180 195 150 150 @#$#@#$#@ 1 @#$#@#$#@