Skip to main content

A library with algorithms on 2 player games.

Project description

DOI DOI

Join the Game Theory Discord server to chat -- direct invite link.

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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nashpy-0.0.43.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nashpy-0.0.43-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file nashpy-0.0.43.tar.gz.

File metadata

  • Download URL: nashpy-0.0.43.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for nashpy-0.0.43.tar.gz
Algorithm Hash digest
SHA256 3a5a8492daa2d8d8dd7a41ca9745887502970b5bc2c2018763950cbbb8c12845
MD5 f4bf091b46f63bdc3a7a0cb6998d9263
BLAKE2b-256 e53432469f128492bbf00b0d9b2fc6c2022b698e6f0f53cb719c2dd5e3a36dd5

See more details on using hashes here.

File details

Details for the file nashpy-0.0.43-py3-none-any.whl.

File metadata

  • Download URL: nashpy-0.0.43-py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for nashpy-0.0.43-py3-none-any.whl
Algorithm Hash digest
SHA256 9ec9a9795b6084b580b4bc2a17216643a39ebaf1d58503e3b9689b3d2d55ce42
MD5 c858912ae2d1e0ae663720efcd3867fc
BLAKE2b-256 2db1b83c723c172165a9f751e2891dbb6cf32462794771920ed4cf780c3e7c5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page