poli.objective_repository.super_mario_bros.level_utils#

Utilities for transforming levels to arrays and back.

Functions

add_padding_to_level(level[, n_padding])

Adds padding to the left of the level, giving room for the agent to land.

clean_level(level)

Cleans a level by removing Mario (token id: 11), and replacing it with empty space.

level_to_array(level_txt)

Parses a level from string to numpy array.

level_to_list(level_txt)

Takes a level as a string and returns a list of lists of individual tokens.

levels_to_onehot(levels[, n_sprites])

Transforms an array [b, w, h] of integers into a one-hot array [b, n_sprites, w, h].

onehot_to_levels(levels_onehot[, sampling, seed])

Transforms a level from probits to integers.

vectorized(prob_matrix, items)