class documentation

Represents a 2D grid with traversal functionality.

Method __init__ Initializes the Grid with given dimensions.
Method calculate_offset Calculates the current (x, y) offset in physical space.
Method decrement_on_column Moves the current position one step upward.
Method decrement_on_row Moves the current position one step to the left.
Method increment_on_column Moves the current position one step downward.
Method increment_on_row Moves the current position one step to the right.
Instance Variable column_size Number of columns in the grid. (int)
Instance Variable current_x Current horizontal position (column index). (int)
Instance Variable current_y Current vertical position (row index). (int)
Instance Variable row_size Number of rows in the grid. (int)
def __init__(self, row_size: int, column_size: int): (source)

Initializes the Grid with given dimensions.

Parameters
row_size:intNumber of rows in the grid. (int)
column_size:intNumber of columns in the grid. (int)
def calculate_offset(self, distance_between_pos: float, dir_x: Direction, dir_y: Direction) -> tuple[float, float]: (source)

Calculates the current (x, y) offset in physical space.

Parameters
distance_between_pos:floatDistance between adjacent grid positions. (float)
dir_x:DirectionUndocumented
dir_y:DirectionUndocumented
Returns
tuple[float, float]The (x, y) offset based on the current position. (Tuple[float, float])
def decrement_on_column(self): (source)

Moves the current position one step upward.

Wraps to the previous column if at the top of a column. Raises an error if moving beyond the top-left corner of the grid.

Raises
ValueErrorIf the position goes below (0, 0).
def decrement_on_row(self): (source)

Moves the current position one step to the left.

Wraps to the previous row if at the start of a row. Raises an error if moving beyond the top-left corner of the grid.

Raises
ValueErrorIf the position goes below (0, 0).
def increment_on_column(self): (source)

Moves the current position one step downward.

Wraps to the next column if the end of a column is reached. Raises an error if moving beyond the bottom-right corner of the grid.

Raises
ValueErrorIf the position exceeds the grid bounds.
def increment_on_row(self): (source)

Moves the current position one step to the right.

Wraps to the next row if the end of a row is reached. Raises an error if moving beyond the bottom-right corner of the grid.

Raises
ValueErrorIf the position exceeds the grid bounds.
column_size: int = (source)

Number of columns in the grid. (int)

current_x: int = (source)

Current horizontal position (column index). (int)

current_y: int = (source)

Current vertical position (row index). (int)

row_size: int = (source)

Number of rows in the grid. (int)