NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
HubNet Activities/Unverified

Note: This model is unverified. It has not yet been tested and polished as thoroughly as our other models.

For information about HubNet, click here.

(back to the library)

Prisoners Dilemma HubNet

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This model is a HubNet version of the Prisoner's Dilemma. The Prisoner's Dilemma is a famous game-theory situation that models the costs and benefits of collaboration or treason between free agents where there is a struggle over some capital.

The game has implications for a variety of social situations that involve negotiations in the absence of absolute trust between agents, such as in politics and economics. The game is a succession of interactions between agents, with each agent trying to maximize personal gains over all interactions. In this game, aggressive behavior is not necessarily the best strategy for maximizing personal gains. The rules of the game are such that agents are penalized when behaving aggressively in interacting with another aggressive agent, At each interaction between agents, each agent decides whether to 'cooperate' or 'defect.' These household terms in economics come from the following hypothetical situation.

The Prisoner's Dilemma presents an interesting problem: if you and your accomplice in crime are imprisoned, then in order to minimize the overall jail time you should cooperate with your partner by remaining silent and not confessing. However, you may choose to defect the unsaid "contract" with your partner by confessing.Let's assume you have confessed. If your partner does not confess you will go free. If your partner confesses, you will go to jail for three years, much better than the five you would have earned had you refused to confess. Unfortunately, your partner is in the same position. Acting rationally in the short term, you will both be worse off. For more introductory information, please refer in the NetLogo models library to the PD BASIC model found in the PRISONER'S DILEMMA suite. Note also that in this model, the traditional year values, such as '3 years' or '5 years,' are given for modification.

HOW IT WORKS

This model allows for many students within a classroom to challenge each other over a network. Students will keep switching partners by moving their agents around on the screen and they can switch strategies. Students compete to see who has gained the maximum points over all interactions.

Moreover, this model allows students to gain a grasp of computer programming. An input box on the screen allows students to edit and author strategies. Following are the strategies that students can choose from (see the STRATEGY-CHOICE chooser in the HubNet client):

Strategies:

  • Random -- Randomly cooperate or defect.

  • Cooperate -- Always cooperate.

  • Defect -- Always defect.

  • Go-by-Majority -- Totals the number of times that partners defected against me. If the majority of the time, up to that point, the partner has defected, defect. Otherwise, cooperate.

  • Tit-for-Tat -- If my opponent from the previous round cooperated with me, cooperate this round. If my opponent from the previous round defected against me, defect this round. Initially cooperate.

  • Suspicious-Tit-for-Tat - Same as the Tit-for-Tat strategy, except I initially defect.

  • Tit-for-Two-Tats -- If my opponents from the two previous rounds defected against me, defect this round. Otherwise, cooperate. Initially cooperate.

  • Pavlov -- If my partner from last round cooperated with me, repeat my action from last round. If my partner from last round defected against me, choose the opposite action from the one I used last round. Initially random.

  • Unforgiving -- Always cooperate, until an opponent defects against me. Once an opponent defected against me, always defect, against everyone.

Rules for the Iterated Prisoner's Dilemma

  1. This game will consist of matches in which each student competes against one opponent at a time. Students may search for partners on their own. Once paired, students will play 10 rounds, and then separate and look for other partners.

  2. Each round the student and his/her partner will earn or lose points by either cooperating (C) or defecting (D) based on the rules set in their individual client. Each students' strategy is either selected (the STRATEGY-CHOICE ) or edited on the HubNet client.

  3. The point system is determined by the administrator, using the 4 sliders under "PAYOFF." That is, the administrator does not change the basic game but the value of the prizes and penalties.

HOW TO USE IT

Buttons:

SETUP: Begin playing the iterated prisoner's dilemma. RERUN: All players set their total back to zero, and are ready to replay PLAY: When students pair up, they will play a user-defined number of turns before separating CREATE ANDROID: Creates a computer player to compete with students

Switches:

ALLOW-STRATEGY-CHANGE?: If on, students will be able to change their strategies. If off, they will be locked into the last working strategy in their client until it is turned on again.

Sliders:

COMPUTER STRATEGY - Select the computer's strategy from the drop-down list below.

Plots:

STRATEGY PLOTS: Shows the total points accumulated for each given strategy. Once a strategy is modified by a student, the results of that student's success/failure will not be plotted on this.

C-D PLOT: Plots the total number of times players have cooperated, and the total number of times players have defected.

THINGS TO NOTICE

Watch the plots for the different strategies. Is there a serious difference between tit-for-tat and suspicious-tit-fot-tat? Does one strategy really beat out the rest?

See how often students cooperate and defect. In the long run, do students learn to switch to more trusting strategies? Or do students all too often defect?

THINGS TO TRY

  1. Experiment with playing different strategies one against the other. Which strategies do the best? Which do the worst? Why?

  2. Let it run for a while with hundreds of computer players to see which strategies win under these conditions.

  3. There is a mode in which students cannot change their strategies. Encourage them to code their own strategies, and then make them stick to that. Which strategy seemed to work the best?

EXTENDING THE MODEL

Students know the history of their last round, but not any of the previous rounds. Think of a way to have clients be able to store the history of previous plays, and know what their current partner has done in other rounds.

NETLOGO FEATURES

Note the use of the turtle variable label to display each turtle's average score in the view.

RELATED MODELS

PD Basic, PD N-Person Iterated, PD Basic Evolutionary, PD 2-Person Iterated

HOW TO CITE

If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:

Please cite the HubNet software as:

COPYRIGHT AND LICENSE

Copyright 2003 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This activity and associated models and materials were created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

(back to the NetLogo Models Library)