Exploitation vs. Protection HubNet Model Blass Final Project
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model is a way to explore how people select whether to exploit, protect, or ignore their neighbors when their neighbors can see what they have previously done. Turtles have social currency, which tracks how well they are doing.
HOW IT WORKS
Every turn, users who were caught stealing last turn (red turtles) move somewhere on the board. Then everyone else (including new turtles) move. Finally, everyone selects their next action.
There is a global probability of not getting caught which indicates how likely a thieving turtle is to go undetected.
If turtles steal and no one nearby protects or they get away with the theft, they get a certain amount of social currency from their neighbors. If someone nearby protects and the thief is not sufficiently sneaky, the protectors get social currency from the thieves. If someone protects and fails to catch a thief, they give social currency to all their neighbors.
HOW TO USE IT
If you were caught stealing last turn (you are red), choose where to move by clicking on the screen. If you did not steal or were not caught, you move after the thieves. Finally, everyone chooses what to do next.
THINGS TO NOTICE
Pay close attention to the probability of getting away with theft. It defines how likely you are to be caught if you steal and someone near you protects.
CREDITS AND REFERENCES
This model was developed by Joseph Blass as part of a final project for Uri Wilensky's Multi-Agent Modeling class at Northwestern University, Spring 2015.
Comments and Questions
globals [ shape-options social-gain ] turtles-own [ ;;; internal setting variables user-id my-shape social-currency ;;; turn variables take-action my-neighbors got-away? already-moved? action-selected? next-xcor next-ycor ;;; lifetime variables my-thefts my-placids my-protects how-many-times-I-got-away ;;; helper variables my-count ;; this is just a placeholder variable; not at all necessary for logic but is handy to avoid retyping code bloacks ] to startup hubnet-reset setup end to setup ca ask patches [ set pcolor grey ] set social-gain 10 ;; the one global; might want to make the increment greater or smaller reset-ticks end to play update-active-turtles display if (any? turtles) [ ;;; first code block resets internals, moves the turtles, and picks what to do ask turtles [ ;;; reset some information at each tick send-player-info set got-away? false set already-moved? false set action-selected? false set my-neighbors other turtles in-radius 10 ;; this is a smaller radius than the baseline netlogo model since we want to give turtles a chance to avoid thieves ] if any? turtles with [color = red] [ hubnet-broadcast-message "thieves who were caught stealing last turn (red turtles) move (10 seconds)" move-thieves ;;; thieves move first so that others can avoid them ask turtles with [color = red] [ setxy next-xcor next-ycor ] display ;; have to tick multiple times per round; in this function we also update user info ] hubnet-broadcast-message "everyone else moves (10 seconds)" move-others ;;; then everyone else ask turtles with [not (color = red)] [ setxy next-xcor next-ycor ] display hubnet-broadcast-message "Everyone: pick what you're going to do next. You have 10 seconds" get-actions ;;; after everyone has moved, they choose what to do resolve ;;; and they resolve the consequences of their actions, including color change tick ] end to resolve ;;; this is only its own function out of convenience; could be in-line with go ask turtles [ ifelse (take-action = "steal") [ steal if (random 100 < probability-of-getting-away) [ set got-away? true set how-many-times-I-got-away how-many-times-I-got-away + 1] set my-thefts my-thefts + 1] ;;; thieves have a chance of getting away with it [ ifelse (take-action = "protect") [ protect set my-protects my-protects + 1] [ do-nothing set my-placids my-placids + 1] ] ] end to steal ;;; note that steal actually handles MOST of what happens to turtles, i.e., both thieves and protectors ;;; in this implementation, a successful thief takes TOTAL social-gain divided amongst the victims. another possibility would be to have it take a social-gain from EACH victim ifelse (got-away? or not any? my-neighbors with [take-action = "protect"]) ;; if no one is watching out for thieves or you get away with it [ set my-count (count my-neighbors) if (my-count > 0) ;; provided you have neighbors [ set social-currency (social-currency + social-gain) ;; get social-gain from chumpy neighbors ask my-neighbors [set social-currency (social-currency - (social-gain / [my-count] of myself))] ];; each neighbor loses social-gain/count neighbors ;;; if you have no neighbors, don't sweat it, you do nothing. set color green ;;; it looks like you did nothing ] ;;; otherwise, someone is watching out for thieves AND you got caught [ set my-count (count my-neighbors with [take-action = "protect"]) set social-currency (social-currency - social-gain) ;; lose social-gain ask my-neighbors with [take-action = "protect"] [ set social-currency (social-currency + (social-gain / [my-count] of myself))] ;;; protectors don't each get social-gain, since the more protectors you have, the less each protection matters set color red ;;; labeled a thief ] end to protect set my-count (count my-neighbors with [take-action = "steal" and not got-away?]) if (my-count = 0) ;; if none of your neighbors tried to steal and did not get away with it, then you are being a busybody [ set social-currency (social-currency - social-gain) ;; lose social-gain ask my-neighbors [set social-currency (social-currency + (social-gain / [count my-neighbors] of myself))]] ;;; all your neighbors are smugly satisfied with themselves and each other set color blue ;;; protectors turn blue regardless of whether they are nosy or not end to do-nothing ;;; the only thing we need to do within this function is change the color a bit set color green end to update-active-turtles while [ hubnet-message-waiting? ] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-member ] [ if hubnet-exit-message? [ remove-member ] ] ] end ;; Create a turtle, set its shape, color, and position ;; and tell the node what its turtle looks like and where it is to create-new-member crt 1 [ set user-id hubnet-message-source set social-currency 20 ;; they should start with something so they have something to lose. set my-shape one-of shapes set shape my-shape set size 3 set color black hubnet-send-message user-id (word "You are a: " my-shape) send-player-info ] end to move-thieves ask turtles with [(color = red)] [ ;;; just the people who stole last turn hubnet-send-message user-id "Click where you want to move next. You have 10 seconds." ] reset-timer while [timer < 10] [ while [hubnet-message-waiting?] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-member ] [ ifelse hubnet-exit-message? [ remove-member ] [ ask turtles with [user-id = hubnet-message-source and color = red and not already-moved?] [ ifelse hubnet-message-tag = "View" [ set next-xcor (item 0 hubnet-message) set next-ycor (item 1 hubnet-message) set already-moved? true] [hubnet-send-message user-id "Please click within the view screen."] ] ] ] ] ] end to move-others ask turtles with [ not (color = red)] [ ;;; just people who did not steal hubnet-send-message user-id "Click where you want to move next. You have 10 seconds." ] reset-timer while [timer < 10] [ while [hubnet-message-waiting?] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-member ] [ ifelse hubnet-exit-message? [ remove-member ] [ ask turtles with [user-id = hubnet-message-source and not (color = red) and not already-moved?] [ ifelse hubnet-message-tag = "View" [ set next-xcor (item 0 hubnet-message) set next-ycor (item 1 hubnet-message) set already-moved? true] [hubnet-send-message user-id "Please click within the view screen."] ] ] ] ] ] end to get-actions reset-timer while [timer < 15] [ while [hubnet-message-waiting?] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-member ] [ ifelse hubnet-exit-message? [ remove-member ] [ ask turtles with [user-id = hubnet-message-source and not action-selected?] ;; just to stop people from changing their actions a lot and slowing things down [ ifelse hubnet-message-tag = "View" [hubnet-send-message user-id "Please select an action using one of the buttons."] [ set take-action hubnet-message-tag set action-selected? true] ] ] ] ] ] end to remove-member ask turtles with [user-id = hubnet-message-source] [die] end to send-player-info ;; player procedure ;;; global info hubnet-send user-id "Percent Chance of getting away with stealing" probability-of-getting-away hubnet-send user-id "Your social currency" social-currency hubnet-send user-id "How many times you've stolen" my-thefts hubnet-send user-id "How many times you've protected" my-protects hubnet-send user-id "How many times you've done nothing" my-placids hubnet-send user-id "How many times you got away with stealing" how-many-times-I-got-away hubnet-send user-id "Richest Turtle" highest-score hubnet-send user-id "Poorest Turtle" lowest-score end to-report highest-score report max [social-currency] of turtles end to-report lowest-score report min [social-currency] of turtles end to-report proportion-turtles-who-just-stole ifelse (count turtles = 0) [report 0] [ report turtles-who-just-stole / count turtles] end to-report proportion-turtles-who-just-protected ifelse (count turtles = 0) [report 0] [ report turtles-who-just-protected / count turtles] end to-report proportion-turtles-who-just-did-nothing ifelse (count turtles = 0) [report 0] [ report turtles-who-just-did-nothing / count turtles] end to-report turtles-who-just-stole report count turtles with [take-action = "steal"] end to-report turtles-who-just-protected report count turtles with [take-action = "protect"] end to-report turtles-who-just-did-nothing report count turtles with [take-action = "do-nothing"] end to-report num-thefts ;; turtle reporter report my-thefts end to-report num-placidities report my-placids end to-report num-protections report my-protects end to-report times-gotten-away report how-many-times-I-got-away end
There are 3 versions of this model.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.