All Projects → gavento → gamegym

gavento / gamegym

Licence: MIT license
A game theory framework with examples and algorithms

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to gamegym

shallow-blue
UCI Chess engine written in C++11
Stars: ✭ 55 (+12.24%)
Mutual labels:  game-theory
mxfactorial
a payment application intended for deployment by the united states treasury
Stars: ✭ 36 (-26.53%)
Mutual labels:  game-theory
prometheus-spec
Censorship-resistant trustless protocols for smart contract, generic & high-load computing & machine learning on top of Bitcoin
Stars: ✭ 24 (-51.02%)
Mutual labels:  game-theory
axle
Axle Domain Specific Language for Scientific Cloud Computing and Visualization
Stars: ✭ 65 (+32.65%)
Mutual labels:  game-theory
datafsm
Machine Learning Finite State Machine Models from Data with Genetic Algorithms
Stars: ✭ 14 (-71.43%)
Mutual labels:  game-theory
Neural-Fictitous-Self-Play
Scalable Implementation of Neural Fictitous Self-Play
Stars: ✭ 52 (+6.12%)
Mutual labels:  game-theory
CovGT-3DRegistration-matlab
A 3D Scene Registration Method via Covariance Descriptors and an Evolutionary Stable Strategy Game Theory Solver
Stars: ✭ 20 (-59.18%)
Mutual labels:  game-theory
Java-Questions-and-Solutions
This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
Stars: ✭ 34 (-30.61%)
Mutual labels:  game-theory
gtsa
Game Tree Search Algorithms - C++ library for AI bot programming
Stars: ✭ 68 (+38.78%)
Mutual labels:  game-theory
ilqgames
Iterative Linear-Quadratic Games!
Stars: ✭ 54 (+10.2%)
Mutual labels:  game-theory
egtplot
egtplot: A python package for 3-Strategy Evolutionary Games
Stars: ✭ 33 (-32.65%)
Mutual labels:  game-theory
matching
A package for solving matching games.
Stars: ✭ 97 (+97.96%)
Mutual labels:  game-theory
Computational-Economics
Algorithmic game theory, recursive macroeconomics, machine learning for econometrics
Stars: ✭ 35 (-28.57%)
Mutual labels:  game-theory
Deep-Learning-Mahjong---
Reinforcement learning (RL) implementation of imperfect information game Mahjong using markov decision processes to predict future game states
Stars: ✭ 45 (-8.16%)
Mutual labels:  game-theory
algorithms
The All ▲lgorithms documentation website.
Stars: ✭ 114 (+132.65%)
Mutual labels:  game-theory
gt
Source files for my course on Game Theory.
Stars: ✭ 28 (-42.86%)
Mutual labels:  game-theory

Game Gym

MIT Licence Build Status PyPI version codecov Coverage Status

A game theory framework providing a collection of games, common API and a several game-theoretic algorithms.

The goal of the project is to provide tools for buildng complex games (e.g. board games, with partial information or simultaneous moves), computation of approximate strateges and creating artificial intelligence for such games, and to be a base for robust value learning experiments.

Under active development, looking for ideas and contributors!

Overview

Algorithms:

  • Outcome sampling MCCFR Nash equilibrium computation
  • Exact best response and exploitability
  • Approximate best response and exploitablity
  • Sparse SGD value learning (with values linear in known features)
  • Plotting strategy development (see plots for Matching Pennies, Rock-Paper-Scissors, Goofspiel(4))

Games:

  • General matrix games (normal form games), Rock-paper-scissors, Matching pennies, Prisoner's dilemma, ...
  • Goofspiel (GOPS)
  • One-card poker, Dice-poker

Game interface

For an exploration of API in Rust, see GTCogs.

To implement game you define one class derived from gamegym.Game with the following interface:

class MyRockPaperScissor(PartialInformationGame):
    ACTIONS = ("rock", "paper", "scissors")
    def __init__(self):
        # Set thenumber of players and all game actions
        super().__init__(2, self.ACTIONS)

    def initial_state(self) -> StateInfo:
        # Return node information, here player 0 is active and has all actions.
        # Note that in this simple game we do not use any game state.
        return StateInfo.new_player(state=None, player=0, actions=self.ACTIONS)

    def update_state(self, situation: Situation, action) -> StateInfo:
        # Return the node information after playing `action` in `situation`.
        if len(situation.history) == 0:
            return StateInfo.new_player(state=None, player=1, actions=self.ACTIONS)
        p1payoff = 1.0 # TODO: compute from `situation`, e.g. from `situation.history`
        return StateInfo.new_terminal(state=None, payoff=(x, -x))

# Create game instance
game = MyRockPaperScissor()
# Initial situation
s1 = game.start()
# Play some actions
s2 = game.play(s1, "rock")
s3 = s2.play("paper") # alias for game.play(s2, "paper")
# See game result
assert s3.is_terminal()
assert s3.payoff == (-1.0, 1.0)

The available base classes are PerfectInformationGame and PartialInformationGame (with specialised subclasses ObservationSequenceGame, SimultaneousGame and MatrixGame - which would be a better fit for Rock-Paper-Scissors).

The main auxiliary structs common to all games are StateInfo that contains the information about the game node itself, and Situation which additionally contains game history, accumulated payoffs, the game itself etc.

Game state is any structure the game uses to keep track of the actual game state, e.g. cards in all hands, game board state, map, ... This is not generally visible to players in partial information game, any observations are passed with observations=(p0_obs, p1_obs, public_obs) to StateInfo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].