Skip to main content

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/

Metadata

Release files for nashpy 0.0.43

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nashpy 0.0.43
File Size Uploaded
nashpy-0.0.43.tar.gz 3.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for nashpy 0.0.43
File Interpreter ABI Platform
nashpy-0.0.43-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / nashpy-0.0.43.tar.gz

Download URL nashpy-0.0.43.tar.gz
Size 3.1 MB
Tags Source
SHA-256 checksum
How to use checksums
3a5a8492daa2d8d8dd7a41ca9745887502970b5bc2c2018763950cbbb8c12845
BLAKE2b-256 checksum
How to use checksums
e53432469f128492bbf00b0d9b2fc6c2022b698e6f0f53cb719c2dd5e3a36dd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / nashpy-0.0.43-py3-none-any.whl

Download URL nashpy-0.0.43-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ec9a9795b6084b580b4bc2a17216643a39ebaf1d58503e3b9689b3d2d55ce42
BLAKE2b-256 checksum
How to use checksums
2db1b83c723c172165a9f751e2891dbb6cf32462794771920ed4cf780c3e7c5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release history Release notifications | RSS feed

This release

0.0.43 This release

2 release files

0.0.41

2 release files

0.0.38

2 release files

0.0.37

2 release files

0.0.36

2 release files

0.0.35

2 release files

0.0.33

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

2 release files

0.0.18

1 release file

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

1 release file

0.0.13

1 release file

0.0.12

2 release files

0.0.10

1 release file

0.0.9

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page