Bridges-Python  3.4.4
Bridges(Python API)
Public Member Functions | Public Attributes | List of all members
bridges.game_grid.GameGrid Class Reference
Inheritance diagram for bridges.game_grid.GameGrid:
bridges.grid.Grid

Detailed Description

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.

Author
David Burlinson, Matthew McQuaigue

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
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]
 

Constructor & Destructor Documentation

◆ __init__()

def bridges.game_grid.GameGrid.__init__ (   self,
  rows = None,
  cols = None 
)

Grid Constructor.

Parameters
rowsrepresenting the number of rows of the grid
colsrepresenting the number of columns of the grid

Member Function Documentation

◆ draw_symbol()

def bridges.game_grid.GameGrid.draw_symbol (   self,
  row,
  col,
  symbol,
  color 
)

Draw a symbol at the location of row,col with color.

Parameters
rowrow index to set color
colcol index to set color
symbolsymbol argument to set the symbol at the chosen position
colorNamed Color enum argument to set the background at the chosen position

◆ get_bg_color()

def bridges.game_grid.GameGrid.get_bg_color (   self,
int  row,
int  col 
)

Get the background color at cell row, col.

Parameters
rowrow index to get color
colcol index to get color
Returns
Color at row, col

◆ get_data_structure_representation()

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

Returns
dict represnting the game_grids json

◆ get_data_structure_type()

def bridges.game_grid.GameGrid.get_data_structure_type (   self)

Get the data structure type.

Returns
str representing the data structure type

Reimplemented from bridges.grid.Grid.

◆ get_fg_color()

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
Returns
Color at row, col

◆ get_symbol()

def bridges.game_grid.GameGrid.get_symbol (   self,
int  row,
int  col 
)

Get the symbol at cell row, col.

Parameters
rowrow index to get color
colcol index to get color

◆ get_symbol_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

◆ initialize_game_Grid()

None bridges.game_grid.GameGrid.initialize_game_Grid (   self)

Populate the grid with default game cells.

◆ run_length()

def bridges.game_grid.GameGrid.run_length (   self,
  arr 
)

◆ set_bg_color()

None bridges.game_grid.GameGrid.set_bg_color (   self,
int  row,
int  col,
  color 
)

Set background color of a cell using an enum argument.

Parameters
rowrow index to set color
colcol index to set color
colorNamed Color enum argument to set the background at the chosen position

◆ set_encoding()

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"

◆ set_fg_color()

def bridges.game_grid.GameGrid.set_fg_color (   self,
int  row,
int  col,
  color 
)

Set foreground color of a cell using an enum argument.

Parameters
rowrow index to set color
colcol index to set color
colorNamed Color enum argument to set the background at the chosen position

Member Data Documentation

◆ bf_bg

bridges.game_grid.GameGrid.bf_bg

◆ bf_fg

bridges.game_grid.GameGrid.bf_fg

◆ bf_symbols

bridges.game_grid.GameGrid.bf_symbols

◆ encoding

bridges.game_grid.GameGrid.encoding

◆ grid_size

bridges.game_grid.GameGrid.grid_size

The documentation for this class was generated from the following file: