concepts.benchmark.gridworld.minigrid.gym_minigrid.minigrid.Grid#

class Grid[source]#

Bases: object

Represent a grid and operations on it

Methods

copy()

decode(array)

Decode an array grid encoding back into a grid

encode([vis_mask])

Produce a compact numpy encoding of the grid

get(i, j)

horz_wall(x, y[, length, obj_type])

process_vis(agent_pos)

render(tile_size[, agent_pos, agent_dir, ...])

Render this grid at a given scale :param r: target renderer object :param tile_size: tile size in pixels

render_tile(obj[, agent_dir, highlight, ...])

Render a tile and cache the result

rotate_left()

Rotate the grid to the left (counter-clockwise)

set(i, j, v)

slice(topX, topY, width, height)

Get a subset of the grid

vert_wall(x, y[, length, obj_type])

wall_rect(x, y, w, h)

Attributes

tile_cache

__init__(width, height)[source]#
Parameters:
  • width (int) –

  • height (int) –

__new__(**kwargs)#
copy()[source]#
static decode(array)[source]#

Decode an array grid encoding back into a grid

encode(vis_mask=None)[source]#

Produce a compact numpy encoding of the grid

get(i, j)[source]#
Return type:

WorldObj | None

horz_wall(x, y, length=None, obj_type=Wall)[source]#
process_vis(agent_pos)[source]#
render(tile_size, agent_pos=None, agent_dir=None, highlight_mask=None)[source]#

Render this grid at a given scale :param r: target renderer object :param tile_size: tile size in pixels

classmethod render_tile(obj, agent_dir=None, highlight=False, tile_size=TILE_PIXELS, subdivs=3)[source]#

Render a tile and cache the result

rotate_left()[source]#

Rotate the grid to the left (counter-clockwise)

set(i, j, v)[source]#
Parameters:
slice(topX, topY, width, height)[source]#

Get a subset of the grid

vert_wall(x, y, length=None, obj_type=Wall)[source]#
wall_rect(x, y, w, h)[source]#
tile_cache = {}#