Maze Builder Docs 8.10.23
Loading...
Searching...
No Matches
mazes::state_utils Class Reference

Static Public Member Functions

static void parse_dimensions (const std::unordered_map< std::string, std::string > &args, unsigned int &rows, unsigned int &cols, unsigned int &levels) noexcept
 Parses the maze dimensions from the given arguments.
static bool has_distances (const std::unordered_map< std::string, std::string > &args) noexcept
 Checks if the "distances" argument is present in the given arguments.
static configurator build_configurator (const args &a, const algo default_algo=algo::DFS) noexcept
 Builds a configurator from the front entry of the given arguments.
static state::ID output_state_for (const std::unordered_map< std::string, std::string > &args) noexcept
 Determines the output state based on the given arguments.
static bool advance_args (const runtime_app::context &ctx) noexcept
static void reseed_from_args (const std::unordered_map< std::string, std::string > &args, randomizer &rng) noexcept
template<typename... Mappers>
static void validate_mappers (Mappers &&...mapper) noexcept
static void check_before_resize (grid_operations *ops, unsigned int rows, unsigned int cols, unsigned int levels) noexcept
 Resets the grid's topology (links) before each generation.

Member Function Documentation

◆ build_configurator()

configurator mazes::state_utils::build_configurator ( const args & a,
const algo default_algo = algo::DFS )
staticnoexcept

Builds a configurator from the front entry of the given arguments.

Shared by every state implementing create_contract so arg parsing lives in one place.

Parameters
aThe parsed arguments
default_algoThe algorithm used when the arguments do not select one
Returns
A configurator populated with dimensions, distances, algorithm and mask source

◆ check_before_resize()

void mazes::state_utils::check_before_resize ( grid_operations * ops,
unsigned int rows,
unsigned int cols,
unsigned int levels )
staticnoexcept

Resets the grid's topology (links) before each generation.

resize() always clears cell links even when dimensions are unchanged; without this, repeated maze generation at the same size (e.g. rebuilding on keypress) would keep linking new random walls on top of the previous maze's links, so the maze gradually loses walls / becomes fully open over time.

Parameters
opsPointer to the grid operations.
rowsDesired number of rows.
colsDesired number of columns.
levelsDesired number of levels.

◆ has_distances()

bool mazes::state_utils::has_distances ( const std::unordered_map< std::string, std::string > & args)
staticnoexcept

Checks if the "distances" argument is present in the given arguments.

This function checks if the "distances" argument is present in the provided

Parameters
argsThe arguments to check for the "distances" key.
Returns
True if the "distances" argument is present, false otherwise.

◆ output_state_for()

state::ID mazes::state_utils::output_state_for ( const std::unordered_map< std::string, std::string > & args)
staticnoexcept

Determines the output state based on the given arguments.

Parameters
argsThe arguments containing the output information.
Returns
The corresponding state::ID for the output.

◆ parse_dimensions()

void mazes::state_utils::parse_dimensions ( const std::unordered_map< std::string, std::string > & args,
unsigned int & rows,
unsigned int & cols,
unsigned int & levels )
staticnoexcept

Parses the maze dimensions from the given arguments.

Parameters
argsThe arguments containing the dimension information.
rowsReference to store the number of rows.
colsReference to store the number of columns.
levelsReference to store the number of levels.

The documentation for this class was generated from the following file: