101#include <type_traits>
178template<
class Free ,
class Moves = FourMoves >
179std::vector< std::vector< int > >
180gridDistances(
int rows ,
int cols ,
const std::vector< GridCell > & sources ,
181 Free && free ,
const Moves & moves =
FOUR_MOVES );
210template<
class Free ,
class Moves = FourMoves >
240template<
class T ,
class Moves = FourMoves >
241std::size_t
floodFill( std::vector< std::vector< T > > & M ,
int r ,
int c ,
242 const std::type_identity_t< T > & color ,
267#include "ADS/graph/impl/Grid.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The visits of a GRAPH of section 9.5 and their applications, each in time on lists or vectors of adj...
std::vector< std::vector< int > > gridDistances(int rows, int cols, const std::vector< GridCell > &sources, Free &&free, const Moves &moves=FOUR_MOVES)
the distance in moves of each cell of the grid from the nearest source, INF if none reaches it,...
bool insideGrid(int rows, int cols, GridCell x)
whether is a cell of a grid
constexpr std::array< GridCell, 8 > EIGHT_MOVES
the moves to the sides and to the corners of a cell, those of the king
Definition Grid.h:123
std::pair< int, int > GridCell
a cell of a grid, or a move as the difference of two cells
Definition Grid.h:114
std::remove_cv_t< decltype(FOUR_MOVES) > FourMoves
the type of FOUR_MOVES, the default range of moves
Definition Grid.h:139
std::size_t floodFill(std::vector< std::vector< T > > &M, int r, int c, const std::type_identity_t< T > &color, const Moves &moves=FOUR_MOVES)
the cell of and all the cells joined to it by moves through cells of its color get the color ; the ...
int gridDistance(int rows, int cols, GridCell s, GridCell t, Free &&free, const Moves &moves=FOUR_MOVES)
the distance in moves from the cell to the cell of the grid through the cells with ,...
int knightDistance(int n, GridCell s, GridCell t)
the fewest moves of a knight from to on an board, INF if it cannot get there
constexpr std::array< GridCell, 8 > KNIGHT_MOVES
the moves of the knight
Definition Grid.h:131
constexpr std::array< GridCell, 4 > FOUR_MOVES
the moves to the four sides of a cell: up, left, down, right
Definition Grid.h:117