Skip to content

Latest commit

 

History

History
87 lines (66 loc) · 3.53 KB

README.md

File metadata and controls

87 lines (66 loc) · 3.53 KB

PDSA - Prisoner's Dilemma Strategy Analyzer

Overview

The Prisoner's Dilemma Strategy Analyzer is an open-source project designed to explore and analyze strategies within the framework of the Prisoner's Dilemma, a standard example of a game analyzed in game theory that shows why two completely rational individuals might not cooperate, even if it appears that it is in their best interest to do so. Inspired by the comprehensive discussion at Stanford Encyclopedia of Philosophy, this tool allows users to define strategies, run simulations, and generate analytical reports in various formats to determine the best course of action in a competitive environment.

Features

  • Define and compare multiple strategies within the Prisoner's Dilemma context.
  • Run simulations with a configurable number of iterations.
  • Use different solvers for strategy analysis.
  • Generate reports in text, JSON, and HTML formats.

Installation

Before you can run the Strategy Analyzer, ensure you have Go installed on your system. Download Go if you haven't already.

Usage

To run the program, navigate to the project directory in your terminal and execute the following command:

go run cmd/main.go --config <PATH_TO_CONFIG_FILE>

or use an environment variable:

export CONFIG_PATH=<CONFIG_PATH>

The configuration file should be in YAML format. Here's an example of how to structure your configuration:

runners:
  - tag: "Unconditional Cooperator vs Random"
    iterations: 50
    solver: smp
    strategies:
      - cu
      - rand
  - tag: "Unconditional Cooperator vs Tip for Tip"
    iterations: 50
    solver: smp
    strategies:
      - cu
      - tft
  - tag: "Random vs Tip for Tip"
    iterations: 50
    solver: smp
    strategies:
      - rand
      - tft

viewers:
  - type: html
    out: ./results/result.html
  - type: text
    out: ./results/result.text
  - type: json
    out: ./results/result.json

Configuring Your Simulations

Runners

  • tag: A unique identifier for the simulation.
  • iterations: The number of times the simulation will run.
  • solver: The method used for solving the game. Currently, only smp (simple method) is available.
  • strategies: The strategies to compare. Options include cu, rand, and tft (tit for tat).

Viewers

  • type: The format of the output report (html, text, or json).
  • out: The output path for the report file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments