hive.envs.gym_env module

class hive.envs.gym_env.GymEnv(env_name, num_players=1, **kwargs)[source]

Bases: BaseEnv

Class for loading gym environments.

Parameters
  • env_name (str) – Name of the environment (NOTE: make sure it is available in gym.envs.registry.all())

  • num_players (int) – Number of players for the environment.

  • kwargs – Any arguments you want to pass to create_env() or create_env_spec() can be passed as keyword arguments to this constructor.

create_env(env_name, **kwargs)[source]

Function used to create the environment. Subclasses can override this method if they are using a gym style environment that needs special logic.

Parameters

env_name (str) – Name of the environment

create_env_spec(env_name, **kwargs)[source]

Function used to create the specification. Subclasses can override this method if they are using a gym style environment that needs special logic.

Parameters

env_name (str) – Name of the environment

reset()[source]

Resets the state of the environment.

Returns

The initial observation of the new episode. turn (int): The index of the agent which should take turn.

Return type

observation

step(action)[source]

Run one time-step of the environment using the input action.

Parameters

action – An element of environment’s action space.

Returns

Indicates the next state that is an element of environment’s observation space. reward: A reward achieved from the transition. done (bool): Indicates whether the episode has ended. turn (int): Indicates which agent should take turn. info (dict): Additional custom information.

Return type

observation

render(mode='rgb_array')[source]

Displays a rendered frame from the environment.

seed(seed=None)[source]

Reseeds the environment.

Parameters

seed (int) – Seed to use for environment.

close()[source]

Additional clean up operations