92#define BJ_MAZE_NO_CELL ((uint32_t)-1)
114#define BJ_MAZE_NORTH BJ_MAZE_DIR_NORTH
116#define BJ_MAZE_WEST BJ_MAZE_DIR_WEST
118#define BJ_MAZE_SOUTH BJ_MAZE_DIR_SOUTH
120#define BJ_MAZE_EAST BJ_MAZE_DIR_EAST
General-purpose definitions for Banjo API.
Recoverable error handling.
uint32_t bj_bool
Boolean type used throughout the Banjo API.
void bj_maze_close_all(struct bj_maze *maze)
Close every passage, leaving the maze as it came out of its constructor.
uint32_t bj_maze_cell_count(const struct bj_maze *maze)
How many cells the maze has.
bj_maze_dir
The four neighbour slots of a cell on a square grid.
bj_bool bj_maze_cell_is_open(const struct bj_maze *maze, uint32_t cell, enum bj_maze_dir dir)
Tell whether cell has a passage through slot dir.
uint8_t bj_maze_degree(const struct bj_maze *maze)
How many neighbour slots each cell has.
uint32_t bj_maze_adjacent_cell(const struct bj_maze *maze, uint32_t cell, enum bj_maze_dir dir)
Find what sits in slot dir of cell, wall or no wall.
bj_bool bj_maze_cell_opened(const struct bj_maze *maze, uint32_t cell, enum bj_maze_dir dir)
void bj_open_maze(struct bj_maze *maze)
void bj_maze_open_all(struct bj_maze *maze)
Open every passage there is, leaving one open field.
uint32_t bj_maze_adjacent(const struct bj_maze *maze, uint32_t cell, enum bj_maze_dir dir)
struct bj_maze * bj_create_maze_ortho2d(size_t width, size_t height, struct bj_error **error)
Allocate a new orthogonal 2D maze, with every wall still standing.
void bj_destroy_maze(struct bj_maze *maze)
Deletes a struct bj_maze object and releases associated memory.
uint32_t bj_close_maze_cell(struct bj_maze *maze, uint32_t cell, enum bj_maze_dir dir)
Put the wall back between cell and its neighbour through dir.
uint32_t bj_maze_ortho2d_cell(const struct bj_maze *maze, size_t row, size_t col)
Find the cell at a position of an orthogonal 2D maze.
uint32_t bj_open_maze_cell(struct bj_maze *maze, uint32_t cell, enum bj_maze_dir dir)
Carve a passage out of cell through slot dir.
void bj_close_maze(struct bj_maze *maze)
@ BJ_MAZE_DIR_NORTH
Towards the top of the grid.
@ BJ_MAZE_DIR_EAST
Towards the right of the grid.
@ BJ_MAZE_DIR_SOUTH
Towards the bottom of the grid.
@ BJ_MAZE_DIR_WEST
Towards the left of the grid.
Pseudo-random number generation API.