PRISIONER’S DILEMMA CODING CHALLENGE
Emma Bateman is a software engineer based in the US. She holds a Bachelor of Science (B.S.), Computer science and a Master of Computational Linguistics.
The prisoner’s dilemma, one of the most famous game theories, was conceptualized by Merrill Flood and Melvin Dresher in 1950. It was later formalized and named by Canadian mathematician, Albert William Tucker.
The prisoner’s dilemma basically provides a framework for understanding how to strike a balance between cooperation and competition and is a useful tool for strategic decision-making.
The goal of this project is to build a prisioner’s dilemma simulator to test different strategies under several scenarios. You will have to write functions to ensure each player faces off against each other player, calculate the score of each player and determine the outcome of the game based on the player strategies. For example, when all players are cooperators or when some of the them are defectors and the rest are cooperators.
There is a guidelines section where Emma breaks down the project in 8 steps and provide hints to complete the challenge. But it is a practice project, not a tutorial, so you will have to come up with the final solution.
The project is also a basic OOP challenge since you will you have to create classes and write methods.
DOWNLOAD / CONTENT
You will receive an email with a ZIP file. The download is also available on your account.
The ZIP file includes:
1) INSTRUCTIONS: A PDF with the project description. It includes the guidelines section mentioned above to help you complete the challenge step by step.
2) SOLUTIONS: A Jupiter Notebook including detailed explanations and comments about how the code works. The code provided in the solutions has been written by a senior developer so it is clean and easy to understand. A great way to learn and adopt right habits to create quality software.
IMPORTANT: To see the solutions (Notebook) you need to have Jupyter or the ANACONDA package installed on your machine. If you do not have it, you may download it here. It is free.
WHAT YOU WILL PRACTICE
– Classes and methods.
– Lists comprehension
– Conditional statements.
– Loops (for).
– Function creation.
This project is highly recommended for Python advanced students feeling comfortable with core Python concepts like loops, nested loops or functions definition. The difficulty is to understand the dilemma and to code it.
If you need additional information, do not hesitate to contact us.