popgym.envs.concentration ========================= .. py:module:: popgym.envs.concentration .. autoapi-nested-parse:: Classic game of concentration. A deck of cards is shuffled and placed face-down. The player can flip two cards, if they match they get a reward otherwise they dont. Classes ------- .. autoapisummary:: popgym.envs.concentration.Concentration popgym.envs.concentration.ConcentrationEasy popgym.envs.concentration.ConcentrationMedium popgym.envs.concentration.ConcentrationHard Module Contents --------------- .. py:class:: Concentration(num_decks=1, deck_type='ranks') Bases: :py:obj:`popgym.core.env.POPGymEnv` Classic game of concentration. A deck of cards is shuffled and placed face-down. The player can flip two cards, if they match they get a reward otherwise they dont. Args: num_decks: Number of decks to play with deck_type: String denoting what we are matching. Can be the card colors (colors) or the card ranks (ranks) Returns: A gym environment .. py:attribute:: obs_requires_prev_action :value: True .. py:attribute:: deck .. py:attribute:: episode_length .. py:attribute:: success_reward_scale :value: 0.038461538461538464 .. py:attribute:: failure_reward_scale .. py:attribute:: facedown_card .. py:attribute:: observation_space .. py:attribute:: state_space .. py:attribute:: action_space .. py:attribute:: last_in_play_idx :value: [] .. py:attribute:: last_trying_card_already_up :value: False .. py:method:: step(action: gymnasium.core.ActType) -> Tuple[gymnasium.core.ObsType, float, bool, bool, dict] Run one timestep of the environment's dynamics using the agent actions. When the end of an episode is reached (``terminated or truncated``), it is necessary to call :meth:`reset` to reset this environment's state for the next episode. .. versionchanged:: 0.26 The Step API was changed removing ``done`` in favor of ``terminated`` and ``truncated`` to make it clearer to users when the environment had terminated or truncated which is critical for reinforcement learning bootstrapping algorithms. Args: action (ActType): an action provided by the agent to update the environment state. Returns: observation (ObsType): An element of the environment's :attr:`observation_space` as the next observation due to the agent actions. An example is a numpy array containing the positions and velocities of the pole in CartPole. reward (SupportsFloat): The reward as a result of taking the action. terminated (bool): Whether the agent reaches the terminal state (as defined under the MDP of the task) which can be positive or negative. An example is reaching the goal state or moving into the lava from the Sutton and Barto Gridworld. If true, the user needs to call :meth:`reset`. truncated (bool): Whether the truncation condition outside the scope of the MDP is satisfied. Typically, this is a timelimit, but could also be used to indicate an agent physically going out of bounds. Can be used to end the episode prematurely before a terminal state is reached. If true, the user needs to call :meth:`reset`. info (dict): Contains auxiliary diagnostic information (helpful for debugging, learning, and logging). This might, for instance, contain: metrics that describe the agent's performance state, variables that are hidden from observations, or individual reward terms that are combined to produce the total reward. In OpenAI Gym