![]() |
Bridges-Python-3.0.2
3.0.2
Bridges(PythonAPI)
|
This is a class in BRIDGES for representing an (m x n) grid.
Each position in the grid will hold a GameCell object, each of which has a foreground color, background color, and a symbol.
Public Member Functions | |
| def | set_encoding |
| Enable changing the game grid encoding when building JSON representation. More... | |
| def | get_data_structure_type (self) |
| def | __init__ (self, rows=None, cols=None) |
| Grid Constructor. More... | |
| def | initialize_game_Grid (self) |
| Populate the grid with default game cells. More... | |
| def | get_bg_color |
| Get the background color at cell row, col. More... | |
| def | set_bg_color |
| Set background color of a cell using an enum argument. More... | |
| def | get_fg_color |
| Get the foreground color at cell row, col. More... | |
| def | set_fg_color |
| Set foreground color of a cell using an enum argument. More... | |
| def | get_symbol |
| Get the symbol at cell row, col. More... | |
| def | get_symbol_color (self, row, col) |
| Get the symbol color at row,col. More... | |
| def | draw_symbol (self, row, col, symbol, color) |
| Draw a symbol at the location of row,col with color. More... | |
| def | get_data_structure_representation (self) |
| Get the JSON representation of the game grid. More... | |
| def | run_length (self, arr) |
Public Member Functions inherited from bridges.grid.Grid | |
| def | get_data_structure_type (self) |
| Get the data structure type. More... | |
| def | __init__ (self, kwargs) |
| Grid constructor. More... | |
| def | dimensions (self) |
| Getter for the dimensions of the grid. More... | |
| def | get |
| Get the row,col element in the grid. More... | |
| def | set |
| set the (row, col) element in the grid More... | |
Public Attributes | |
| encoding | |
| bf_bg | |
| bf_fg | |
| bf_symbols | |
| grid_size | |
Public Attributes inherited from bridges.grid.Grid | |
| grid | |
Additional Inherited Members | |
Static Public Attributes inherited from bridges.grid.Grid | |
| list | grid_size = [10, 10] |
| list | maxGridSize = [1080, 1920] |
| def bridges.game_grid.GameGrid.__init__ | ( | self, | |
rows = None, |
|||
cols = None |
|||
| ) |
Grid Constructor.
(int) rows: representing the number of rows of the grid (int) cols: representing the number of columns of the grid
| def bridges.game_grid.GameGrid.draw_symbol | ( | self, | |
| row, | |||
| col, | |||
| symbol, | |||
| color | |||
| ) |
Draw a symbol at the location of row,col with color.
(int) row: row index to set color (int) col: col index to set color
| symbol | symbol argument to set the symbol at the chosen position |
| color | Named Color enum argument to set the background at the chosen position :return: |
| def bridges.game_grid.GameGrid.get_bg_color | ( | self, | |
| row | |||
| ) |
Get the background color at cell row, col.
(int) row: row index to get color (int) col: col index to get color
| def bridges.game_grid.GameGrid.get_data_structure_representation | ( | self, | |
| dict | |||
| ) |
Get the JSON representation of the game grid.
Contains separate foreground, background, and symbol arrays
| def bridges.game_grid.GameGrid.get_data_structure_type | ( | self | ) |
| def bridges.game_grid.GameGrid.get_fg_color | ( | self, | |
| row | |||
| ) |
Get the foreground color at cell row, col.
(int) row: row index to get color (int) col: col index to get color
| def bridges.game_grid.GameGrid.get_symbol | ( | self, | |
| row | |||
| ) |
Get the symbol at cell row, col.
(int) row: row index to get color (int) col: col index to get color
| def bridges.game_grid.GameGrid.get_symbol_color | ( | self, | |
| row, | |||
| col | |||
| ) |
Get the symbol color at row,col.
(int) row: row index to get color (int) col: col index to get color
| def bridges.game_grid.GameGrid.initialize_game_Grid | ( | self, | |
| None | |||
| ) |
Populate the grid with default game cells.
| def bridges.game_grid.GameGrid.run_length | ( | self, | |
| arr | |||
| ) |
| def bridges.game_grid.GameGrid.set_bg_color | ( | self, | |
| row | |||
| ) |
Set background color of a cell using an enum argument.
(int) row: row index to set color (int) col: col index to set color
| color | Named Color enum argument to set the background at the chosen position |
| def bridges.game_grid.GameGrid.set_encoding | ( | self, | |
| encoding | |||
| ) |
Enable changing the game grid encoding when building JSON representation.
(str) encoding: type of encoding. Supports "raw" and "rle"
| def bridges.game_grid.GameGrid.set_fg_color | ( | self, | |
| row | |||
| ) |
Set foreground color of a cell using an enum argument.
(int) row: row index to set color (int) col: col index to set color
| color | Named Color enum argument to set the background at the chosen position |
| bridges.game_grid.GameGrid.bf_bg |
| bridges.game_grid.GameGrid.bf_fg |
| bridges.game_grid.GameGrid.bf_symbols |
| bridges.game_grid.GameGrid.encoding |
| bridges.game_grid.GameGrid.grid_size |
1.8.13