# Game Theory v1

Model was written in NetLogo 5.0.4
•
Viewed 756 times
•
Downloaded 78 times
•
Run 0 times

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

Info tab cannot be displayed because of an encoding error

## Comments and Questions

Please start the discussion about this model!
(You'll first need to log in.)

Click to Run Model

turtles-own [ prob-s1 ;probability of choosing strategy 1 prob-s2 ;probability of choosing strategy 2 strategy1? ;boolean, "true" if strategy 1 is chosen utility ;payoff received at that round potential-utility ;payoff of choosing other strategy in the same round partnered? ;boolean, "true" if turtle is partnered with another turtle partner ;the opposing turtle in a game partner-strategy1? ;boolean, "true" if partner chose strategy 1 strategy ;the learning strategy used by each turtle ] to setup clear-all crt number-utility-max [ set strategy "utility-max" set label 1 ;labels used to identify what strategy a turtle is using ] crt number-seek-fair [ set strategy "seek-fair" set label 2 ] crt number-predictors [ set strategy "predict" set label 3 ] ask turtles [ set shape "person" set size 2 ;size used to make turtles easier to see set color one-of [red blue] ;determines if turtles are player 1s (blue) or player 2s (red) set partnered? false ;turtles are initially unpaired set partner nobody prob-initial ;sets turtles indifferent to their strategies setxy random-xcor random-ycor ] reset-ticks end ;turtle procedure ;sets initial probabilities to prob-initial set prob-s1 0.5 set prob-s2 0.5 end to go end -round ;releases partners to allow them to look for new ones ask turtles [ partner-up ;turtles partner-up if they are next to an opposing player ] let partnered-turtles turtles with [partnered? = true] ask partnered-turtles [play-a-round] ask turtles [ if prob-s1 > 1 [ ;probabilites can't exceed 1 or go below 0 set prob-s1 1 set prob-s2 0 ] if prob-s1 < 0 [ set prob-s1 0 set prob-s2 1 ] ] tick end ;releases partners to end-round let partnered-turtles turtles with [ partnered? = true] ask partnered-turtles [ release-partner ] end ;partnered-turtle procedure to release-partner set partnered? false set partner nobody rt 180 end ;turtle procedure ;opposing turtles pair up if they're spatially located right next to each other to partner-up if (not partnered?) [ rt (random-float 90 - random-float 90) fd 1 set partner one-of (turtles-at -1 0) with [ (not partnered?) and (color != [color] of myself) ] if partner != nobody [ set partnered? true set heading 270 ask partner [ set partnered? true set partner myself set heading 90 ] ] ] end ;partnered-turtle procedure to play-a-round let partnered-turtles turtles with [partnered? = true] pick-a-strategy ;turtles probabilistically make a decision set partner-strategy1? [strategy1?] of partner ask partnered-turtles with [color = blue] [ set-utilities ] ask partnered-turtles with [strategy = "utility-max"] [ utility-max ] ask partnered-turtles with [strategy = "seek-fair"] [ seek-fair ] ask partnered-turtles with [(color = blue) and (strategy = "predict")] [ predict-blue ] ask partnered-turtles with [(color = red) and (strategy = "predict")] [ predict-red ] end ;partnered-turtle procedure ;turtles probabilistically select a strategy to pick-a-strategy ifelse random-float 1 < prob-s1 [ set strategy1? true ][ set strategy1? false ] end ;player1 partnered-turtle procedure ;looks at the strategy choices and assigns the appropriate utility values to set-utilities ifelse strategy1? = true [ ifelse partner-strategy1? = true [ set utility p1s1-utility set potential-utility p1s2-utility ask partner [ set utility p2s1-utility set potential-utility p2s2-utility ] ][ set utility p1s1-utility2 set potential-utility p1s2-utility2 ask partner [ set utility p2s2-utility set potential-utility p2s1-utility ] ] ][ ifelse partner-strategy1? = true [ set utility p1s2-utility set potential-utility p1s1-utility ask partner [ set utility p2s1-utility2 set potential-utility p2s2-utility2 ] ][ set utility p1s2-utility2 set potential-utility p1s1-utility2 ask partner [ set utility p2s2-utility2 set potential-utility p2s1-utility2 ] ] ] end ;partnered-turtle utility maximizer learning procedure ;if a turtle could've done better by choosing the other strategy, given their partner stays the same, ;then they become more likely to choose the other strategy. If they're happy with their decision, ;they become more likely to make the same decision to utility-max ifelse strategy1? = true [ if utility < potential-utility [ set prob-s1 prob-s1 - (.001 * (potential-utility - utility)) set prob-s2 prob-s2 + (.001 * (potential-utility - utility)) ] ][ if utility < potential-utility [ set prob-s1 prob-s1 + (.001 * (potential-utility - utility)) set prob-s2 prob-s2 - (.001 * (potential-utility - utility)) ] ] end ;partnered-turtle competitive learning procedure ;If a turtle loses to their opponent, then they become less likely to make the same decision. They're ;indifferent to ties though to seek-fair ifelse strategy1? = true [ if utility < [utility] of partner [ set prob-s1 prob-s1 - (.001 * (([utility] of partner) - utility)) set prob-s2 prob-s2 + (.001 * (([utility] of partner) - utility)) ] ][ if utility < [utility] of partner [ set prob-s1 prob-s1 + (.001 * (([utility] of partner) - utility)) set prob-s2 prob-s2 - (.001 * (([utility] of partner) - utility)) ] ] end ;player1 partnered-turtle predictor learning procedure ;They look at whether or not their partner made their best decision. The turtles assume that their partner will tend ;towards making the best decision. They then respond with their best decision. to predict-blue ifelse partner-strategy1? = true [ ifelse [potential-utility] of partner > [utility] of partner [ ifelse p1s1-utility2 > p1s2-utility2 [ set prob-s1 prob-s1 + .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 - .001 * ([potential-utility] of partner - [utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 + .001 * ([potential-utility] of partner - [utility] of partner) ] ][ ifelse p1s1-utility > p1s2-utility [ set prob-s1 prob-s1 + .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 - .001 * ([utility] of partner - [potential-utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 + .001 * ([utility] of partner - [potential-utility] of partner) ] ] ][ ifelse [potential-utility] of partner > [utility] of partner [ ifelse p1s1-utility > p1s2-utility [ set prob-s1 prob-s1 + .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 - .001 * ([potential-utility] of partner - [utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 + .001 * ([potential-utility] of partner - [utility] of partner) ] ][ ifelse p1s1-utility2 > p1s2-utility2 [ set prob-s1 prob-s1 + .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 - .001 * ([utility] of partner - [potential-utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 + .001 * ([utility] of partner - [potential-utility] of partner) ] ] ] end ;player2 partnered-turtle predictor learning procedure to predict-red ifelse partner-strategy1? = true [ ifelse [potential-utility] of partner > [utility] of partner [ ifelse p2s1-utility2 > p2s2-utility2 [ set prob-s1 prob-s1 + .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 - .001 * ([potential-utility] of partner - [utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 + .001 * ([potential-utility] of partner - [utility] of partner) ] ][ ifelse p2s1-utility > p2s2-utility [ set prob-s1 prob-s1 + .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 - .001 * ([utility] of partner - [potential-utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 + .001 * ([utility] of partner - [potential-utility] of partner) ] ] ][ ifelse [potential-utility] of partner > [utility] of partner [ ifelse p2s1-utility > p2s2-utility [ set prob-s1 prob-s1 + .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 - .001 * ([potential-utility] of partner - [utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([potential-utility] of partner - [utility] of partner) set prob-s2 prob-s2 + .001 * ([potential-utility] of partner - [utility] of partner) ] ][ ifelse p2s1-utility2 > p2s2-utility2 [ set prob-s1 prob-s1 + .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 - .001 * ([utility] of partner - [potential-utility] of partner) ][ set prob-s1 prob-s1 - .001 * ([utility] of partner - [potential-utility] of partner) set prob-s2 prob-s2 + .001 * ([utility] of partner - [potential-utility] of partner) ] ] ] end

There are 4 versions of this model.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Game Theory v1.png | preview | Preview for 'Game Theory v1' | about 10 years ago, by Peter Jourgensen | Download |

PeterJourgensen_June3.docx | word | Progress Report 3 | about 10 years ago, by Peter Jourgensen | Download |

PeterJourgensen_May20.docx | word | Progress Report 1 | about 10 years ago, by Peter Jourgensen | Download |

PeterJourgensen_May27.docx | word | Progress Report 2 | about 10 years ago, by Peter Jourgensen | Download |

This model does not have any ancestors.

This model does not have any descendants.