# Trust Game Model

No preview image

Model was written in NetLogo 5.3
•
Viewed 222 times
•
Downloaded 12 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

turtles-own [ strategy money gift reward trustee? satisfied? ] globals [ groups turnId dissatisfied satisfied ] to setup ;; resizing world and set some globals ca while [remainder N groupSize > 0] [ set N N + 1 ] let m (ceiling (sqrt N)) - 1 let p (600 / m) resize-world 0 m 0 m set-patch-size p set groups N / groupSize if replicator > 10 [set replicator (replicator / 10)] ;; initialize turtles ask n-of N patches [ sprout 1 [ set strategy n-values 8 [precision (random-float 1) 2] set trustee? false set satisfied? false ;; this list codes strategy and its updating in one-way no-iteration trust game: ;; item 0 - gift ;; item 1 - expected reward ;; item 2 - downgrading gift ;; item 3 - upgrading gift ;; item 4 - reward ;; item 5 - expected gift ;; item 6 - downgrading reward ;; item 7 - upgrading reward ] ] ask n-of (N / 2) turtles [ set trustee? true ] ;; initialize playgounds ask n-of groups patches [ set pcolor blue ] ;; preparing last things ask turtles [ recolour move-to one-of patches with [pcolor = black] ] count-satisfied reset-ticks end to go round-starts set turnId 0 repeat turns [ set turnId (turnId + 1) turn ] round-ends tick if ticks >= (rounds) [stop] end to round-starts ;; trustees find free playground, non-trustees pairs with a trustee ask turtles with [trustee?][move-to one-of patches with [pcolor = blue and not any? turtles-here]] ask turtles with [not trustee?] [move-to one-of patches with [pcolor = blue and count (turtles-here) = 1]] end to round-ends ask turtles [ move-to one-of patches with [pcolor = black] if changeRolesAtEoR? and not changeRolesAtEoT? [ set trustee? (not trustee?) recolour ] ] count-satisfied end to turn ;; turtles receive money ask turtles [ set money (money + moneyPerTurn) ] ;; non-trustees send money ask turtles with [not trustee?] [ set gift (item 0 strategy * moneyPerTurn) set money (money - gift) ask other turtles-here [set gift (replicator * [gift] of myself)] ] ;; trustees receive money, update strategy, set reward and send reward back ask turtles with [trustee?][ set money (money + gift) if updateStrategy? [update-trustee-strategy] let s4 (item 4 strategy) set reward ifelse-value trusteeIncludesHerMoney? [(gift + moneyPerTurn) * s4][gift * s4] set money (money - reward) ask other turtles-here [set reward ([reward] of myself)] ] ;; non-trustees receive reward and update strategy ask turtles with [not trustee?] [ set money (money + reward) if updateStrategy? [update-non-trustee-strategy] ] ;; changing roles if changeRolesAtEoT? [ ask turtles [ set trustee? (not trustee?) recolour ] ] end to update-trustee-strategy let s4 (item 4 strategy) let s5 (item 5 strategy) let s6 (item 6 strategy) let s7 (item 7 strategy) let expectedGift (moneyPerTurn * replicator * s5) set satisfied? ifelse-value basedOnMoney? [(money - gift) > (first [money] of other turtles-here) ][gift > expectedGift] ifelse satisfied? [ set s4 precision (s4 + (s7 * (1 - s4))) 3 set strategy replace-item 4 strategy s4 ] [set s4 precision (s4 * s6) 3 set strategy replace-item 4 strategy s4 ] end to update-non-trustee-strategy let s0 (item 0 strategy) let s1 (item 1 strategy) let s2 (item 2 strategy) let s3 (item 3 strategy) let expectedReward ifelse-value trusteeIncludesHerMoney? [((replicator * gift) + moneyPerTurn) * s1][gift * replicator * s1] set satisfied? ifelse-value basedOnMoney? [money > (first [money] of other turtles-here) ][reward > expectedReward] ifelse satisfied? [ set s0 precision (s0 + (s3 * (1 - s0))) 3 set strategy replace-item 0 strategy s0 ] [set s0 precision (s0 * s2) 3 set strategy replace-item 0 strategy s0 ] end ;; this list codes strategy and its updating in trust game: ;; item 0 - gift ;; item 1 - expected reward ;; item 2 - downgrading gift ;; item 3 - upgrading gift ;; item 4 - reward ;; item 5 - expected gift ;; item 6 - downgrading reward ;; item 7 - upgrading reward to recolour set color ifelse-value trustee? [red] [green] end to count-satisfied set dissatisfied (count turtles with [not satisfied?]) set satisfied (count turtles with [satisfied?]) end

There is only one version of this model, created about 3 years ago by František (Francesco) Kalvas.

## Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.