Skip to content

Examples: cipher_objective_worlds

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

Generate a cipher micro-world 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_names) pairs; required.

required
seed int | None

Deterministic seed for maze + cipher sampling.

None

Returns:

Name Type Description
CipherChallenge CipherChallenge

Cipher world state and the app objectives to install.

to_cipher_challenge(base_world, cipher_text_pairs, seed=None)

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

Parameters:

Name Type Description Default
base_world World

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

required
cipher_text_pairs Iterable[CipherObjectivePair]

Iterable of (cipher_text, objective_names) 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
CipherChallenge CipherChallenge

New world with terminal cipher text, plus the selected app objective names to install separately.

Raises:

Type Description
ValueError

If no valid pairs are supplied.