geometor.arcprize.puzzles.grid

class geometor.arcprize.puzzles.grid.Grid(grid, puzzle_id, set_type, index, io_type)[source]

Bases: object

property name
property height
property width
property size
property colors
property color_counts
property model
rotate(k=1)[source]

Rotate the grid by 90 degrees k times. Positive k means clockwise rotation, negative k means counter-clockwise.

returns copy of Grid

flip(axis=0)[source]

Flip the grid along the specified axis. axis=0 flips vertically, axis=1 flips horizontally.

returns copy of Grid

set_pixel(row: int, column: int, color: int) str[source]

Set grid value at a specific coordinate.

set_range(row1: int, column1: int, row2: int, column2: int, color: int) str[source]

Set grid values for a range of pixels.

set_floodfill(row: int, column: int, color: int) str[source]

Flood-fill algorithm to set all contiguous cells connected to (row, column) with the same initial color to the new color.

to_string(row_delimiter='\n', cell_delimiter=' ')[source]
to_image(cell_size=64, add_text=True)[source]