numberlink.registration

Registration helper for the NumberLink environment.

Provides a convenience function to register the environment id NumberLinkRGB-v0 with Gymnasium. The numberlink package automatically calls register_numberlink_v0() during module initialization, so simply importing the package is sufficient to register the environment.

Module Contents

Functions

register_numberlink_v0

Register the environment id with Gymnasium’s registry.

env_creator

Entry-point factory for Gymnasium. Returns a NumberLinkRGBEnv instance.

vector_env_creator

Create a vectorized NumberLink environment.

API

Register the environment id with Gymnasium’s registry.

This function registers the NumberLink environment so it can be instantiated using gymnasium.make. The registration is idempotent and safe to call multiple times. If the environment has already been registered, the function returns immediately without raising an error or duplicating the registration.

The function registers both a standard environment entry point and a vectorized entry point that can be used with gymnasium.make_vec for parallel environment execution.

Note

The numberlink package automatically calls this function during module initialization, so simply importing the package (import numberlink) is sufficient to register the environment. Explicit calls to this function are only needed if you want to register with a custom env_id or in rare cases where you need to ensure registration without importing the package.

Parameters:

env_id (str, optional) – Environment identifier to register. Defaults to "NumberLinkRGB-v0".

Raises:

ValueError – If the provided env_id is empty or improperly formatted according to Gymnasium conventions. The id should follow the pattern [namespace/](env_name)[-v(version)].

Example usage:

import gymnasium as gym
import numberlink  # Automatically registers NumberLinkRGB-v0

# Create a single environment
env = gym.make("NumberLinkRGB-v0")

# Or create a vectorized environment using gymnasium.make_vec
vec_env = gym.make_vec("NumberLinkRGB-v0", num_envs=3)

Note

This function follows Gymnasium>=1.0 conventions and does not use deprecated parameters such as autoreset or apply_api_compatibility that were removed in Gymnasium 1.0.

See also

gymnasium.register()

Core Gymnasium registration function used internally.

gymnasium.make()

Function to instantiate environments by id after registration.

gymnasium.make_vec()

Function to create vectorized environments using the registered vector entry point.

numberlink.registration.env_creator(grid: collections.abc.Sequence[str] | None = None, *, render_mode: RenderMode | None = None, level_id: str | None = None, variant: numberlink.config.VariantConfig | None = None, bridges: collections.abc.Iterable[Coord] | None = None, generator: numberlink.config.GeneratorConfig | None = None, reward_config: numberlink.config.RewardConfig | None = None, render_config: numberlink.config.RenderConfig | None = None, step_limit: int | None = None, palette: dict[str, RGBInt] | None = None, solution: list[list[Coord]] | None = None) numberlink.env.NumberLinkRGBEnv[source]

Entry-point factory for Gymnasium. Returns a NumberLinkRGBEnv instance.

This function is suitable to reference from packaging entry points (gymnasium.envs) so Gymnasium can discover environments automatically when the package is installed.

numberlink.registration.vector_env_creator(num_envs: int = 1, grid: collections.abc.Sequence[str] | None = None, *, render_mode: RenderMode | None = None, level_id: str | None = None, variant: numberlink.config.VariantConfig | None = None, bridges: collections.abc.Iterable[Coord] | None = None, generator: numberlink.config.GeneratorConfig | None = None, reward_config: numberlink.config.RewardConfig | None = None, render_config: numberlink.config.RenderConfig | None = None, step_limit: int | None = None, palette: dict[str, RGBInt] | None = None, solution: list[list[Coord]] | None = None) numberlink.vector_env.NumberLinkRGBVectorEnv[source]

Create a vectorized NumberLink environment.

The function mirrors the standard constructor signature used by Gymnasium when building vector environments.