Git Product home page Git Product logo

mixed-strategies-rs's Introduction

Mixed Strategies

This Rust codebase contains a library crate, mixed-strategies, for computing optimal mixed strategies and game values given the payoff matrix for a classical two-player zero-sum game.

A simple driver program is also provided that reads a payoff matrix (as ASCII text) from standard input and displays the game solution. The examples/ directory in this distribution contains a number of example payoff matrices.

The code in this distribution is an implementation of algorithms described in the most excellent book

The Compleat Strategyst
John D. Williams
RAND Commercial Books 1954
https://www.rand.org/pubs/commercial_books/CB113-1.html

It's fantastic that The RAND Corporation has chosen to provide a free PDF of this book for download: my paper copy is getting pretty dog-eared. I highly recommend this book as an introduction to game theory. All errors and bugs in the implementation are, of course, my own.

Please see the rustdoc for usage of the library crate.

Installation and usage

Example session (for a rock-scissor-paper game):

$ cargo install --git https://github.com/BartMassey/mixed-strategies-rs
...
   Installed package `mixed-strategies v0.1.0 (...)` (executable `mixed-strategies`)
   
$ printf -- '0 1 -1\n   -1 0 1\n   1 -1 0\n' | mixed-strategies  
value 0.000
max 0:0.333 1:0.333 2:0.333
min 0:0.333 1:0.333 2:0.333

Meaning expected game outgome is neutral for both players, and each player should choose row (column) with equal probability.

Haskell

This started out to be a port of my Haskell implementation also called mixed-strategies. If you want Haskell instead of Rust, you can check that out: it's quite similar. I gave up on the port when I realized it would be easier to reimplement from scratch than to understand my old Haskell.

Author

Bart Massey

License

This program is licensed under the "MIT License". Please see the file LICENSE in the source distribution of this software for license terms.

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.