![]() |
Bridges-Python 3.5.0
Bridges(Python API)
|
This is a class in BRIDGES for representing an (m x n) grid. More...
Public Member Functions | |
| None | set_encoding (self, str encoding) |
| Enable changing the game grid encoding when building JSON representation. More... | |
| def | get_data_structure_type (self) |
| Get the data structure type. More... | |
| def | __init__ (self, rows=None, cols=None) |
| Grid Constructor. More... | |
| None | initialize_game_Grid (self) |
| Populate the grid with default game cells. More... | |
| def | get_bg_color (self, int row, int col) |
| Get the background color at cell row, col. More... | |
| None | set_bg_color (self, int row, int col, color) |
| Set background color of a cell using an enum argument. More... | |
| def | get_fg_color (self, int row, int col) |
| Get the foreground color at cell row, col. More... | |
| def | set_fg_color (self, int row, int col, color) |
| Set foreground color of a cell using an enum argument. More... | |
| def | get_symbol (self, int row, int col) |
| 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... | |
| dict | 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 | |
| str | get_data_structure_type (self) |
| Get the data structure type. More... | |
| None | __init__ (self, **kwargs) |
| Grid constructor. More... | |
| list | dimensions (self) |
| Getter for the dimensions of the grid. More... | |
| def | get (self, int row, int col) |
| Get the row,col element in the grid. More... | |
| None | set (self, int row, int col, val) |
| 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] |
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.
| def bridges.game_grid.GameGrid.__init__ | ( | self, | |
rows = None, |
|||
cols = None |
|||
| ) |
Grid Constructor.
| rows | representing the number of rows of the grid |
| cols | representing the number of columns of the grid |
Reimplemented from bridges.grid.Grid.
| def bridges.game_grid.GameGrid.draw_symbol | ( | self, | |
| row, | |||
| col, | |||
| symbol, | |||
| color | |||
| ) |
Draw a symbol at the location of row,col with color.
| row | row index to set color |
| 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 |
| def bridges.game_grid.GameGrid.get_bg_color | ( | self, | |
| int | row, | ||
| int | col | ||
| ) |
Get the background color at cell row, col.
| row | row index to get color |
| col | col index to get color |
| dict bridges.game_grid.GameGrid.get_data_structure_representation | ( | self | ) |
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 | ) |
Get the data structure type.
Reimplemented from bridges.grid.Grid.
| def bridges.game_grid.GameGrid.get_fg_color | ( | self, | |
| int | row, | ||
| int | col | ||
| ) |
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, | |
| int | row, | ||
| int | col | ||
| ) |
Get the symbol at cell row, col.
| row | row index to get color |
| 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
| None bridges.game_grid.GameGrid.initialize_game_Grid | ( | self | ) |
Populate the grid with default game cells.
| def bridges.game_grid.GameGrid.run_length | ( | self, | |
| arr | |||
| ) |
| None bridges.game_grid.GameGrid.set_bg_color | ( | self, | |
| int | row, | ||
| int | col, | ||
| color | |||
| ) |
Set background color of a cell using an enum argument.
| row | row index to set color |
| col | col index to set color |
| color | Named Color enum argument to set the background at the chosen position |
| None bridges.game_grid.GameGrid.set_encoding | ( | self, | |
| str | 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, | |
| int | row, | ||
| int | col, | ||
| color | |||
| ) |
Set foreground color of a cell using an enum argument.
| row | row index to set color |
| 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 |