90#ifndef BJ_MAZE_BUILDER_H
91#define BJ_MAZE_BUILDER_H
156 struct bj_maze_marks* marks
165 struct bj_maze_marks* marks
180 const struct bj_maze_marks* marks,
200 struct bj_maze_marks* marks,
215 struct bj_maze_marks* marks,
257typedef void* (*bj_maze_setup_fn)(
513 struct bj_maze_marks* marks,
General-purpose definitions for Banjo API.
bj_audio_play_note_data data
uint32_t bj_bool
Boolean type used throughout the Banjo API.
struct bj_maze_builder bj_maze_builder
bj_maze_step_fn step
Does one step. Required.
bj_maze_teardown_fn teardown
Releases the state, or NULL.
void * rng_state
Opaque state to pass to next.
struct bj_maze * maze
The maze being carved. Never NULL.
bj_random_u32_fn next
RNG callback. Never NULL.
bj_maze_setup_fn setup
Prepares the state, or NULL.
void * data
Algorithm state. See bj_maze_step_fn.
struct bj_maze_marks * marks
Where to record progress, or NULL.
struct bj_maze_algorithm bj_maze_algorithm_wilson(void)
Wilson's algorithm.
bj_maze_mark
What an algorithm can record about a cell as it works.
bj_bool(* bj_maze_step_fn)(struct bj_maze_build_context *context)
One step of a maze generation algorithm.
void bj_destroy_maze_builder(struct bj_maze_builder *builder)
Destroy a builder and release the algorithm state it accumulated.
void bj_mark_maze_cell(struct bj_maze_marks *marks, uint32_t cell, uint8_t bits)
Add marks to a cell.
bj_bool bj_step_maze_builder(struct bj_maze_builder *builder)
Perform one step of generation.
void *(* bj_maze_setup_fn)(const struct bj_maze_build_context *context, struct bj_error **error)
Prepares whatever an algorithm needs to remember between steps.
bj_bool bj_maze_builder_is_complete(const struct bj_maze_builder *builder)
Tell whether generation has completed.
struct bj_maze_algorithm bj_maze_algorithm_backtracker(void)
The backtracker, known in the literature as the recursive backtracker.
bj_bool bj_reset_maze_builder(struct bj_maze_builder *builder, struct bj_error **error)
Start the algorithm over.
void bj_clear_maze_marks(struct bj_maze_marks *marks)
Take every mark off every cell.
struct bj_maze_algorithm bj_maze_algorithm_sidewinder(void)
The sidewinder algorithm.
struct bj_maze_algorithm bj_maze_algorithm_hunt_and_kill(void)
The hunt-and-kill algorithm.
void bj_run_maze_builder(struct bj_maze_builder *builder)
Step the builder until generation completes.
struct bj_maze_marks * bj_create_maze_marks(const struct bj_maze *maze, struct bj_error **error)
Allocate marks for every cell of maze, all clear.
void bj_unmark_maze_cell(struct bj_maze_marks *marks, uint32_t cell, uint8_t bits)
Take marks off a cell.
uint8_t bj_maze_cell_marks(const struct bj_maze_marks *marks, uint32_t cell)
Read what is recorded about a cell.
struct bj_maze_algorithm bj_maze_algorithm_btree(void)
The binary tree algorithm.
bj_bool bj_maze_builder_completed(const struct bj_maze_builder *builder)
struct bj_maze_builder * bj_create_maze_builder(struct bj_maze *maze, struct bj_maze_algorithm algorithm, struct bj_maze_marks *marks, bj_random_u32_fn next, void *rng_state, struct bj_error **error)
Create a builder that carves maze with algorithm.
void bj_destroy_maze_marks(struct bj_maze_marks *marks)
Release marks.
void(* bj_maze_teardown_fn)(void *data)
Releases what bj_maze_setup_fn produced.
struct bj_maze_algorithm bj_maze_algorithm_aldous_broder(void)
The Aldous-Broder algorithm.
@ BJ_MAZE_MARK_PATH
On the route currently under consideration.
@ BJ_MAZE_MARK_USER
First bit an algorithm may use as it likes.
@ BJ_MAZE_MARK_VISITED
The algorithm is done with this cell.
@ BJ_MAZE_MARK_HEAD
Where the algorithm is working now.
A maze generation algorithm.
Everything a build step is given to work with.
uint32_t(* bj_random_u32_fn)(void *state)
RNG callback type for generator-agnostic distributions.
Header file for Maze representation.
Pseudo-random number generation API.