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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file clubs-gym-0.1.4.tar.gz.

File metadata

  • Download URL: clubs-gym-0.1.4.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for clubs-gym-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b7a502e1551a0f7dc79b7fe9909b884cd44b197e944d0579ae58977f9cee5d58
MD5 6e61fb1c595b3e2ec12aa3a9d497bc3b
BLAKE2b-256 916dbef9e0b2d18e0a1b175d7674acdd4766b3d395b967944b70946a72860655

See more details on using hashes here.

File details

Details for the file clubs_gym-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: clubs_gym-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for clubs_gym-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1cffad4bef03b52cbc0ee0d57bcfcd8d8b63b1a7a55627f3d250018ee44df66d
MD5 d5b91bafbfa38b8e4c8508874f169d0d
BLAKE2b-256 c2561fed55b29f67385624de5b19787adfd0b97417b95d277cb082127df679ab

See more details on using hashes here.

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