Skip to content

darkn3to/prisoners_dilemma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prisoner's Dilemma

This project is a C++ implementation of the classic game theory problem known as the Prisoner's Dilemma. It simulates the interactions between two players who must decide whether to cooperate or betray each other, leading to different outcomes based on their decisions.

The game follows some simple rules:

  • There are 20 rounds in total, each comprising of 10 turns for each player.
  • If both players cooperate, they both receive a mild sentence.
  • If one player betrays while the other cooperates, the betrayer receives no sentence while the cooperator receives a severe sentence.
  • If both players betray each other, they both receive a moderate sentence.

This project was inspired by the video "What Game Theory Reveals About Life, The Universe, and Everything" by Veritasium.

Tabulate by p-ranav was used to tabulate the data.

You may simply clone the repository to your machine and run the command

g++ main.cpp
./a.out

to run the game.

Furthermore, one can also add more strategies in strategies.h to implement unique decision-making approaches.

About

A simple Prisoner's Dilemma game.

Topics

Resources

Stars

Watchers

Forks

Languages