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 using pip install clubs-gym
.
By running import clubs_gym
, several pre-defined 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.
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)