Skip to content

Examples: cipher_objective_levels

generate(width, height, num_required_items, cipher_objective_pairs, seed=None)

Generate a cipher micro-level using the maze generator and adapt it.

Parameters:

Name Type Description Default
width int

Grid width.

required
height int

Grid height.

required
num_required_items int

Number of required cores in the base maze.

required
cipher_objective_pairs Iterable[CipherObjectivePair]

Iterable of (cipher, objective_name) pairs; required.

required
seed int | None

Deterministic seed for maze + cipher sampling.

None

Returns:

Name Type Description
State State

Immutable cipher micro-level state.

to_cipher_level(base_state, cipher_text_pairs, seed=None)

Transform an existing state into a cipher micro-level variant.

Parameters:

Name Type Description Default
base_state State

Source state (e.g. from maze.generate).

required
cipher_text_pairs Iterable[CipherObjectivePair]

Iterable of (cipher_text, objective_name) pairs (required). At least one valid pair (objective registered) must be present.

required
seed int | None

Optional seed for deterministic sampling of the pair.

None

Returns:

Name Type Description
State State

New immutable state with updated objective and message.

Raises:

Type Description
ValueError

If no valid pairs are supplied.