Session 4 : Iterated Prisoners Dilemma - Declarative Programming - Functional Design Patterns - Tutorial

5. Session 4 : Iterated Prisoners Dilemma - Declarative Programming - Functional Design Patterns - Tutorial#

5.1. Session Overview#

This session is a tutorial to allow you to develop your ideas and code for a simulation study of the “Iterated Prisoners Dilemma” (IPD).

5.2. Session Objects#

5.2.1. Primary Objectives#

  • Implement two or more strategies for the IPD

  • Study patterns 1 and 2 that were introduced in Session 2

  • See if you can apply patterns 1 and/or 2 in your code for IDP strategies

  • Use comments and type hints to provide declarative style information about your strategies.

  • Develop a turn function to play a single “turn” of IPD using two of your strategies

  • Use comments and type hints to provide declarative style information about your turn function.

5.2.2. Secondary Objectives#

  • Develop a play function to “play” multiple “turns” of the IPD using your turn function and your strategies.

  • Study pattern 6 from Session 2

  • See if you can apply some aspects of pattern 6 to your play function.

5.3. Post Session#

Complete all of the primary and secondary objectives from this session in preperation for Session 5.

5.4. Resources#

  • The main resource for this Session are the Session 2 notes.

  • You can find some good background information on python type hints here

  • If you are prepared to create an account there is also some good python type checking resources here