Maze Builder Docs 8.10.23
Loading...
Searching...
No Matches
mazes::link_maze_and_create_state Class Referenceabstract

Base state for creating mazes using algorithms that link cells This state encapsulates the common setup and teardown logic for maze-generating algorithms like binary tree, depth-first search, and sidewinder. More...

#include <link_maze_and_create_state.h>

Inheritance diagram for mazes::link_maze_and_create_state:
[legend]
Collaboration diagram for mazes::link_maze_and_create_state:
[legend]

Public Member Functions

 link_maze_and_create_state (const runtime_app::context &ctx, runtime_stack *stack)
 Construct a new link maze and create state.
bool update (randomizer &rng, double delta_time) noexcept override final
 Update the state with the given arguments and delta time Common logic for parsing arguments, setting up configuration, and handling output.
void draw () const noexcept override
std::any create (const args &a, randomizer &rng) noexcept override=0
 Create the maze using algorithm-specific logic.
Public Member Functions inherited from mazes::create_contract
template<typename T>
std::optional< T > create_as (const args &a, randomizer &rng) noexcept
 Calls create and extracts the result as T.
Public Member Functions inherited from mazes::state
 state (const runtime_app::context &c, runtime_stack *rs)

Protected Member Functions

virtual algo get_algo_id () const noexcept=0
 Get the algorithm ID for this maze creation algorithm.
std::string run_link_algorithm (const std::function< bool(grid_operations &)> &link_algorithm) noexcept
 Runs a linking algorithm on the current grid, then calculates distances if requested.
Protected Member Functions inherited from mazes::state
void request_stack_push (ID state_id) const noexcept
void request_stack_pop () const noexcept
void request_stack_clear () const noexcept
const runtime_app::context & get_context () const noexcept
runtime_stack & get_stack () const noexcept

Protected Attributes

args_manager * args_mapper
grid_manager * grid_mapper
processed_text_manager * processed_text_mapper
grid_identifier current_grid_id
bool m_use_distances
int m_distances_start
int m_distances_end
std::string m_result

Additional Inherited Members

Public Types inherited from mazes::state
enum class  ID : unsigned int {
  EMPTY = 0 , LINK_WITH_BINARY_TREE = 1 , LINK_WITH_DFS = 2 , LINK_WITH_SIDEWINDER = 3 ,
  LINK_WITH_PRIMS = 4 , LOAD = 5 , PARSE = 6 , WRITE_TO_IMAGE = 7 ,
  WRITE_TO_STRING = 8 , WRITE_TO_WF_OBJ = 9 , LINK_WITH_MASKED = 10 , TOTAL = 11
}

Detailed Description

Base state for creating mazes using algorithms that link cells This state encapsulates the common setup and teardown logic for maze-generating algorithms like binary tree, depth-first search, and sidewinder.

Constructor & Destructor Documentation

◆ link_maze_and_create_state()

mazes::link_maze_and_create_state::link_maze_and_create_state ( const runtime_app::context & ctx,
runtime_stack * stack )
explicit

Construct a new link maze and create state.

Parameters
ctxThe runtime context
stackThe runtime stack to allow pushing/popping states

Member Function Documentation

◆ create()

std::any mazes::link_maze_and_create_state::create ( const args & a,
randomizer & rng )
nodiscardoverridepure virtualnoexcept

Create the maze using algorithm-specific logic.

Parameters
aThe parsed arguments containing maze parameters
rngThe randomizer for the algorithm
Returns
A std::string result message, or an empty std::any on failure

Implements mazes::create_contract.

Implemented in mazes::bt_maze_create_state, mazes::dfs_maze_create_state, mazes::masked_maze_and_create_state, mazes::prims_maze_create_state, and mazes::sw_maze_create_state.

◆ draw()

void mazes::link_maze_and_create_state::draw ( ) const
overridevirtualnoexcept

Implements mazes::state.

◆ get_algo_id()

virtual algo mazes::link_maze_and_create_state::get_algo_id ( ) const
nodiscardprotectedpure virtualnoexcept

Get the algorithm ID for this maze creation algorithm.

Returns
The algorithm ID to use in the configurator

◆ run_link_algorithm()

std::string mazes::link_maze_and_create_state::run_link_algorithm ( const std::function< bool(grid_operations &)> & link_algorithm)
nodiscardprotectednoexcept

Runs a linking algorithm on the current grid, then calculates distances if requested.

Parameters
link_algorithmLinks the grid's cells; returns false if it could not
Returns
A result message, or an empty string on failure

◆ update()

bool mazes::link_maze_and_create_state::update ( randomizer & rng,
double delta_time )
finaloverridevirtualnoexcept

Update the state with the given arguments and delta time Common logic for parsing arguments, setting up configuration, and handling output.

Parameters
rngThe randomizer for the algorithm
delta_timeTime elapsed since the last update
Returns
False to indicate the state has completed (pops itself from the stack)

Implements mazes::state.


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