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 GridThe wrapped sub-grid
sub_grid_height: usizeCache the calculated height
copies_y: usizeNumber of times the grid is tiled in the y axis
copies_x: usizeNumber of times the grid is tiled in the x axis
Implementations
Return a new wrapper with different tiling
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
Trait Implementations
Build an untiled wrapper from a given sub-grid. See also ExpandedGrid::with_copies
