Git Product home page Git Product logo

nashpy's Introduction

DOI Discord Gitter DOI

Nashpy: a python library for 2 player games.

Nashpy is:

Documentation

Full documentation is available here: http://nashpy.readthedocs.io/

Installation

$ python -m pip install nashpy

To install Nashpy on Fedora, use:

$ dnf install python3-nashpy

Usage

Create bi matrix games by passing two 2 dimensional arrays/lists:

>>> import nashpy as nash
>>> A = [[1, 2], [3, 0]]
>>> B = [[0, 2], [3, 1]]
>>> game = nash.Game(A, B)
>>> for eq in game.support_enumeration():
...     print(eq)
(array([1., 0.]), array([0., 1.]))
(array([0., 1.]), array([1., 0.]))
(array([0.5, 0.5]), array([0.5, 0.5]))
>>> game[[0, 1], [1, 0]]
array([3, 3])

Other game theoretic software

  • Gambit is a library with a python api and support for more algorithms and more than 2 player games.
  • Game theory explorer a web interface to gambit useful for teaching.
  • Axelrod a research library aimed at the study of the Iterated Prisoners dilemma

Development

Clone the repository and create a virtual environment:

$ git clone https://github.com/drvinceknight/nashpy.git
$ cd nashpy
$ python -m venv env

Activate the virtual environment and install tox:

$ source env/bin/activate
$ python -m pip install tox

Make modifications.

To run the tests:

$ python -m tox

To build the documentation. First install the software which also installs the documentation build requirements.

$ python -m pip install flit
$ python -m flit install --symlink

Then:

$ cd docs
$ make html

Full contribution documentation is available at https://nashpy.readthedocs.io/en/latest/contributing/index.html

Pull requests are welcome.

Code of conduct

In the interest of fostering an open and welcoming environment, all contributors, maintainers and users are expected to abide by the Python code of conduct: https://www.python.org/psf/codeofconduct/

nashpy's People

Contributors

drvinceknight avatar katiemcgoldrick avatar michalispanayides avatar l30bigdick avatar asinghgaba avatar alex-konovalov avatar theref avatar nikoleta-v3 avatar fil avatar riabaldevia avatar robert-szeto avatar arwheel avatar firefly-cpp avatar newaijj avatar volume-on-max 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.