INF2004-Project v0.1
 
Loading...
Searching...
No Matches
print_maze Namespace Reference

Functions

str draw_cell (int cell_bitmask, int relative_row)
 
str draw_grid (list[list[int]] maze)
 
str draw_navigator (str ret_str, int rows, int cols, tuple current, int orientation)
 
str draw_path (str ret_str, int rows, int cols, list[tuple[int]] path)
 
int get_direction_from_coords (tuple point_a, tuple point_b)
 
str insert_centre_path_char (str ret_str, int str_num_cols, tuple coords, str char)
 
str insert_path_in_direction (str ret_str, int str_num_cols, tuple coords, int direction)
 
def main ()
 
str pretty_print_maze (bytes serialised_maze)
 

Detailed Description

Module for printing a maze in a human-readable format.

Function Documentation

◆ draw_cell()

str draw_cell ( int  cell_bitmask,
int  relative_row 
)
Helper function to draw a single cell in a maze.

Args:
    cell_bitmask (int): Bitmask representing the cell.
    relative_row (int): Relative row in the cell to draw. 0 is the top row.

Returns:
    str: A string representing the relative row of the cell.
Here is the caller graph for this function:

◆ draw_grid()

str draw_grid ( list[list[int]]  maze)
Draws a grid of the maze.

Args:
    maze (list[list[int]]): A 2D array representing the maze.

Returns:
    str: A string representing the maze.

References draw_cell().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_direction_from_coords()

int get_direction_from_coords ( tuple  point_a,
tuple  point_b 
)
Gets the direction from point A to point B.

Args:
    point_a (tuple): Point A. Coordinates (X, Y)
    point_b (tuple): Point B. Coordinates (X, Y)

Returns:
    int: The direction from point A to point B.

References get_direction_from_coords(), and insert_centre_path_char().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_centre_path_char()

str insert_centre_path_char ( str  ret_str,
int  str_num_cols,
tuple  coords,
str   char 
)
Inserts a character into the centre of a cell in the maze.

Args:
    ret_str (str): The current maze string.
    str_num_cols (int): The number of columns in the maze string.
    coords (tuple): The coordinates of the cell to insert the character into.
    char (str): The character to insert into the cell.

Returns:
    str: The updated maze string.

References insert_centre_path_char(), and pretty_print_maze().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pretty_print_maze()

str pretty_print_maze ( bytes  serialised_maze)
Prints a maze in a human-readable format.

Args:
    serialised_maze (bytes): Compressed maze string gap bitmask.
    Each hex character represents a cell in the maze.

Returns:
    ret_str (str): A string representing the maze.

References draw_grid().

Here is the call graph for this function:
Here is the caller graph for this function: