Code Monkey home page Code Monkey logo

game-theory-test's Introduction

Simple Prisoner's Dilemma Test I decided to implement after watching Veritasium's video about it

(also as an efficient way to procrastinate studying for my calculus test)

You can implement your own strategy using the Strategy struct that has the decide function which returns either Decision::Share or Decision::Steal. In the factors.rs there are constants for # of rounds played, # of total entities per strategy pool, and how points are distributed. After two pools go against each other, the score function is called on each strategy to change how each entity should behave based on how well it did last round

Implemented in one afternoon so most of the code is unoptimized and very ugly unfortunately.

All thanks to the textplots crate and owo-colors for beautiful teminal graphs & colors

Plotting # of total points gained VS # of rounds played for each strategy:

image

Histogram showing the most common decision in a play-off between two strategies:

Red depicts "steal", green depicts "share". Anything in between means that multiple entities (of the same pool) have chosen a different value

image

LICENSE

Licensed under

game-theory-test's People

Contributors

jedjoud10 avatar

Stargazers

anand jain avatar Shrestha Shashank avatar  avatar Matthew Perry avatar Mikola Samardak avatar Harshaan Babra avatar Tyler Weir avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.