robotic board game
- class rbgame.game.game.RoboticBoardGame(colors_map, targets_map, required_mail, robot_colors, num_robots_per_player=1, with_battery=False, random_num_steps=False, max_step=500, render_mode=None, log_to_file=False)[source]
-
Main class representing the game. The game can be configured with difference parameters.
- Parameters:
colors_map (
str) – Color map for board.target_map – Target map for board.
required_mail (
int) – Number of mails to win.num_robots_per_player (
int) – Number robots per player.with_battery (
bool) – Battery is considered or not.random_num_steps – Robot can move random number of steps each turn or not.
max_step (
int) – Maximum enviroment step.render_mode (
Optional[str]) – The render mode. It can beNoneor'human'.log_to_file (
bool) – Log game process to file or not.
- agent_iter(max_iter=9223372036854775808)
Yields the current agent (self.agent_selection).
Needs to be used in a loop where you step() each iteration.
- Return type:
AECIterable
- last(observe=True)
Returns observation, cumulative reward, terminated, truncated, info for the current agent (specified by self.agent_selection).
- property np_random: Generator
Returns the environment’s internal
_np_randomthat if not set will initialise with a random seed.- Returns:
Instances of np.random.Generator
- property np_random_seed: int
Returns the environment’s internal
_np_random_seedthat if not set will first initialise with a random int as seed.If
np_random_seedwas set directly instead of throughreset()orset_np_random_through_seed(), the seed will take the value -1.- Returns:
int: the seed of the current np_random or -1, if the seed of the rng is unknown
- observe(agent)[source]
- Parameters:
agent (
str) – Agent that need to observe.- Return type:
- Returns:
Observation of this agent. Is is a
dictwith two key:'observation'and'action_mask'. Value of'observation'key is theobservationvectors of all robots concatenated.Observationof robot that is controlled byagentis placed in the first place. Value of'action_mask'key is a binary vector where each element of the vector represents whether the action is legal or not.
- property previous_agent
Previous agent.
- render()[source]
Display all animations to screen. Only works if enviroment render mode is
'human'.- Return type:
- set_wrapper_attr(name, value, *, force=True)
Sets the attribute name on the environment with value, see Wrapper.set_wrapper_attr for more info.
- Return type:
- state()
State returns a global view of the environment.
It is appropriate for centralized training decentralized execution methods like QMIX
- Return type:
- step(action)[source]
Perform enviroment step with input
action.
- property unwrapped: Env[ObsType, ActType]
Returns the base non-wrapped environment.
- Returns:
Env: The base non-wrapped
gymnasium.Envinstance