Skip to main content

clubs is an open ai gym environment for running arbitrary poker configurations.

Project description

Logo

clubs_gym

PyPI Status PyPI Status codecov CodeFactor

clubs_gym is a gym wrapper around the clubs python poker library. clubs is used for running arbitrary configurations of community card poker games. This includes anything from simple Leduc or Kuhn poker to full n-player No Limit Texas Hold'em or Pot Limit Omaha.

Install

Install using pip install clubs-gym.

How to use

By running import clubs_gym, several pre-defined poker clubs poker configurations are registered with gym (call clubs_gym.ENVS for a full list). Custom environments can be registered with clubs_gym.envs.register({"{environment_name}": {config_dictionary})}. Environment names must follow the gym environment name convention ({title-case}-v{version_number}). Check the clubs documentation for additional information about the structure of a configuration dictionary.

Since gym isn't designed for multi-agent games, the api is extended to enable registering agents. This is not required, but ensures each agent only receives the information it's supposed to. An agent needs to inherit from the clubs_gym.agent.base.BaseAgent class and implement the act method. act receives a game state dictionary and needs to output an integer bet size. A list of agents the length of the number of players can then be registered with the environment using env.register_agents. By calling env.act({observation_dictionary}), the observation dictionary is passed to the correct agent and the agent's bet is returned. This can then be passed on the env.step function. An example with an optimal Kuhn agent (clubs_gym.agent.kuhn.NashKuhnAgent) is given below.

Example

import gym

import clubs_gym

env = gym.make("KuhnTwoPlayer-v0")
env.register_agents([clubs_gym.agent.kuhn.NashKuhnAgent(0.3)] * 2)
obs = env.reset()

while True:
    bet = env.act(obs)
    obs, rewards, done, info = env.step(bet)

    if all(done):
        break

print(rewards)

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

clubs-gym-0.1.4.tar.gz (21.1 kB view hashes)

Uploaded Source

Built Distribution

clubs_gym-0.1.4-py3-none-any.whl (20.6 kB view hashes)

Uploaded Python 3

Supported by

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