• Stars
    star
    279
  • Rank 147,967 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python library for 2 player games.

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/

More Repositories

1

Python-Mathematics-Handbook

A set of notebooks for an introduction to Python for Mathematicians.
Jupyter Notebook
166
star
2

amwoss

Applied mathematics problems with Open Source Software: Operational Research with Python and R.
TeX
115
star
3

Simulating_Queues

This is some old legacy code: you should use ciw: https://github.com/ciwpython/ciw
Python
41
star
4

gt

Source files for my course on Game Theory.
Jupyter Notebook
30
star
5

Gamepy

PLEASE DO NOT USE THIS REPOSITORY - IT IS OUTDATED AND NOT VERY GOOD
HTML
23
star
6

Year_3_game_theory_course

This repository contains source code for a game theory course.
TeX
17
star
7

EdinburghFringeJokes

A repo for a blog post looking at the Edinburgh Fringe Festival jokes
17
star
8

md2reveal

A script to easily convert (simple) markdown to reveal html.
Python
16
star
9

Monte_Carlo_Simulation_for_Estimating_pi

Repo for a script to make rain drops in a field so as to estimate pi.
Python
13
star
10

pfm

Python for Mathematics: A book aimed at undergraduate mathematicians learning python
Jupyter Notebook
11
star
11

cfm

Repository for a Python course for university Mathematics students
Jupyter Notebook
9
star
12

DataScienceingDogRates

A repo with some code to analyse dog rates
Jupyter Notebook
8
star
13

ertai

Mathematical modelling of Magic the Gathering
Python
7
star
14

sklDj

A django app as an interface to scikit-learn
Python
7
star
15

Assigning_Fair_Individual_Marks_To_Group_Projects

Repo for the assignment of marks using Cooperative game theory.
CSS
7
star
16

unpeudemath

Repository for my blog
Jupyter Notebook
7
star
17

oop

A jupyter notebook for the teaching of basic Python and OOP
Jupyter Notebook
5
star
18

ghtalks

Organise and share your slide decks
Python
5
star
19

TestingPaper

Jupyter Notebook
4
star
20

pandocipy

Create pdf, html and docx versions of all md files in a directory
Python
4
star
21

agent-based-learn

A library for agent based learning of normal form games
Python
3
star
22

dwys

Language agnostic doctester
Python
2
star
23

video-editing-process

How I prepare teaching videos
2
star
24

dotfiles

A repo with my dotfiles
Shell
2
star
25

Shut_The_Box

Repo with code relevant to the Shut The Box Parlour game
Python
2
star
26

LaTeX_Course

Source files for an intro to LaTeX course
2
star
27

two_thirds_of_the_average_game

A repo with some material to help run a two thirds of the average game.
Python
2
star
28

drvinceknight.github.com

Html code for my site
HTML
2
star
29

blog

A blog about programming (usually scientific python), mathematics (usually game theory) and learning (usually student centred pedagogic approaches).
Jupyter Notebook
2
star
30

Intro_to_Object_Orientated_Programming_With_Python

This repository contains the source files for a 1 day introduction to object orientated programming course which is taught using Python.
CSS
2
star
31

Markov_Chains

This contains sources files for my Markov Chain notes.
Python
2
star
32

LaTeXFilesWordCount

Script to recursively word count all tex files in all subdirectories.
Python
2
star
33

coord_coop

A library to replicate the coordinated cooperation game presented in https://www.frontiersin.org/articles/10.3389/fevo.2018.00062/full
Python
2
star
34

list-of-dev-things

A repository containing lists of concepts, tutorials etc to be able to do development: aimed at beginners.
2
star
35

sal

Generate the transition matrix for snakes 🐍 and ladders
Python
1
star
36

SSI-fellowship-application

1
star
37

pupcoach

Python
1
star
38

Admissions_Talk

Slides for a talk on my work in queueing theory and game theory. The target audience are potential mathematics graduates.
1
star
39

Chapter_7_of_Comp_Sci_Illuminated

Some code I've scribbled down from the pseudo code in CH7 of "Computer Science Illuminated" by Dale and Lewis
Python
1
star
40

Partial_Sum_Transportation_Polytope

A repo for some code for a long overdue paper.
Python
1
star
41

Comparing_recursion_and_iteration

A repo with some code used to compare timing of recursion and iteration
Python
1
star
42

Playing-games-a-case-study-in-active-learning

A paper for https://journals.gre.ac.uk/index.php/msor/about
TeX
1
star
43

pop

Python
1
star
44

CU_BSc_LaTeX_Template

Jupyter Notebook
1
star
45

speak

A repository for my talks
HTML
1
star
46

MathEdWorkshop

A repo for some content for a workshop organised by Prof. Harper and myself.
TeX
1
star
47

MAT013

Code for a SAS/R course.
CSS
1
star
48

MSc_week_0

Introductory refresher session for the MSc course
TeX
1
star
49

Dissertation

OR and Stats MSc Thesis 2015-2016
TeX
1
star
50

SimulatingQueuesInSage

A repo to experiment with simulation of queues in Sage (mainly to make use of @parallel tag)
Python
1
star
51

AnIncompleteOverviewOfSomeApplicationsOfGameTheoryToPatientFlow

A repository for a paper for SBP XLVI
TeX
1
star
52

testing_for_ZD

Recognising zero determinant strategies: code for a paper under review (pre print: https://arxiv.org/abs/1904.00973).
Jupyter Notebook
1
star
53

hphp

A research paper on intergenerational trauma
Jupyter Notebook
1
star
54

HeterogeneousAmbulanceFleetAllocations

Code for optimising ambulance allocation
Jupyter Notebook
1
star