Struct advent_of_code_2021::day_15::ExpandedGrid[−][src]

struct ExpandedGrid<'a> {
    grid: &'a Grid,
    sub_grid_height: usize,
    copies_y: usize,
    copies_x: usize,
}
Expand description

A wrapper around Grid that handles tiling a smaller sub-grid.

Fields

grid: &'a Grid

The wrapped sub-grid

sub_grid_height: usize

Cache the calculated height

copies_y: usize

Number of times the grid is tiled in the y axis

copies_x: usize

Number of times the grid is tiled in the x axis

Implementations

Return a new wrapper with different tiling

The number of cells in the grid

The total width of the grid

The co-ordinates of the bottom right corner of the grid in (y, x) format

Find the meta-co-ordinates of the tile a cell co-ordinate is on

Translate a grid-levey co-ordinates to the sub-grid co-ordinates, i.e. the co-ordinates within the current tile.

Turn co-ordinates into the offset in the underlying list of cell values.

Given grid co-ordinates, get the value from the referenced cell in the sub-grid, and apply the cost modifier based on the tile position.

Copied from grid, but needs to use the ExpandedGrid::get_relative to manage crossing tile boundaries

Copied from grid, but needs to use the ExpandedGrid::get to manage crossing tile boundaries

Trait Implementations

Build an untiled wrapper from a given sub-grid. See also ExpandedGrid::with_copies

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.