Bridges-Python-3.0.2  3.0.2
Bridges(PythonAPI)
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

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]
 

Constructor & Destructor Documentation

◆ __init__()

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

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.

(int) row: row index to set color (int) col: col index to set color

Parameters
symbolsymbol argument to set the symbol at the chosen position
colorNamed Color enum argument to set the background at the chosen position :return:

◆ get_bg_color()

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

Returns
Color at row, col

◆ get_data_structure_representation()

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

Returns
dict represnting the game_grids json

◆ get_data_structure_type()

def bridges.game_grid.GameGrid.get_data_structure_type (   self)

◆ get_fg_color()

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

Returns
Color at row, col

◆ get_symbol()

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

◆ 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()

def bridges.game_grid.GameGrid.initialize_game_Grid (   self,
  None 
)

Populate the grid with default game cells.

◆ run_length()

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

◆ set_bg_color()

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

Parameters
colorNamed Color enum argument to set the background at the chosen position

◆ set_encoding()

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"

◆ set_fg_color()

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

Parameters
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: