rlcard.envs¶
rlcard.envs.blackjack¶
- class rlcard.envs.blackjack.BlackjackEnv(config)¶
Bases:
rlcard.envs.env.Env
Blackjack Environment
rlcard.envs.doudizhu¶
- class rlcard.envs.doudizhu.DoudizhuEnv(config)¶
Bases:
rlcard.envs.env.Env
Doudizhu Environment
- get_action_feature(action)¶
For some environments such as DouDizhu, we can have action features
- Returns
The action features
- Return type
(numpy.array)
rlcard.envs.env¶
- class rlcard.envs.env.Env(config)¶
Bases:
object
The base Env class. For all the environments in RLCard, we should base on this class and implement as many functions as we can.
- get_action_feature(action)¶
For some environments such as DouDizhu, we can have action features
- Returns
The action features
- Return type
(numpy.array)
- get_payoffs()¶
Get the payoffs of players. Must be implemented in the child class.
- Returns
A list of payoffs for each player.
- Return type
(list)
Note: Must be implemented in the child class.
- get_perfect_information()¶
Get the perfect information of the current state
- Returns
A dictionary of all the perfect information of the current state
- Return type
(dict)
- get_state(player_id)¶
Get the state given player id
- Parameters
player_id (int) – The player id
- Returns
The observed state of the player
- Return type
(numpy.array)
- is_over()¶
Check whether the curent game is over
- Returns
True if current game is over
- Return type
(boolean)
- reset()¶
Start a new game
- Returns
Tuple containing:
(numpy.array): The begining state of the game (int): The begining player
- Return type
(tuple)
- run(is_training=False)¶
Run a complete game, either for evaluation or training RL agent.
- Parameters
is_training (boolean) – True if for training purpose.
- Returns
(list): A list of trajectories generated from the environment. (list): A list payoffs. Each entry corresponds to one player.
- Return type
(tuple) Tuple containing
- Note: The trajectories are 3-dimension list. The first dimension is for different players.
The second dimension is for different transitions. The third dimension is for the contents of each transiton
- seed(seed=None)¶
- set_agents(agents)¶
Set the agents that will interact with the environment. This function must be called before run.
- Parameters
agents (list) – List of Agent classes
- step(action, raw_action=False)¶
Step forward
rlcard.envs.gin_rummy¶
File name: envs/gin_rummy.py Author: William Hale Date created: 2/12/2020
- class rlcard.envs.gin_rummy.GinRummyEnv(config)¶
Bases:
rlcard.envs.env.Env
GinRummy Environment
rlcard.envs.leducholdem¶
- class rlcard.envs.leducholdem.LeducholdemEnv(config)¶
Bases:
rlcard.envs.env.Env
Leduc Hold’em Environment
rlcard.envs.limitholdem¶
- class rlcard.envs.limitholdem.LimitholdemEnv(config)¶
Bases:
rlcard.envs.env.Env
Limitholdem Environment
rlcard.envs.mahjong¶
- class rlcard.envs.mahjong.MahjongEnv(config)¶
Bases:
rlcard.envs.env.Env
Mahjong Environment
rlcard.envs.nolimitholdem¶
- class rlcard.envs.nolimitholdem.NolimitholdemEnv(config)¶
Bases:
rlcard.envs.env.Env
Limitholdem Environment
rlcard.envs.registration¶
- class rlcard.envs.registration.EnvRegistry¶
Bases:
object
Register an environment (game) by ID
- make(env_id, config={'allow_step_back': False, 'seed': None})¶
Create and environment instance
- Parameters
env_id (string) – The name of the environment
config (dict) – A dictionary of the environment settings
- register(env_id, entry_point)¶
Register an environment
- Parameters
env_id (string) – The name of the environent
entry_point (string) – A string the indicates the location of the envronment class
- class rlcard.envs.registration.EnvSpec(env_id, entry_point=None)¶
Bases:
object
A specification for a particular instance of the environment.
- rlcard.envs.registration.make(env_id, config={})¶
Create and environment instance
- rlcard.envs.registration.register(env_id, entry_point)¶
Register an environment
- Parameters
env_id (string) – The name of the environent
entry_point (string) – A string the indicates the location of the envronment class
rlcard.envs.uno¶
- class rlcard.envs.uno.UnoEnv(config)¶
Bases:
rlcard.envs.env.Env