darkn3to / prisoners_dilemma

A simple Prisoner's Dilemma game.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.


Languages

Language:C++ 100.0%