Tetris
Grid Class Reference

Public Member Functions

 Grid (Color[,] grid)
 

‍Create a Grid object with a given grid of colors

More...
 
bool CanGo (Tetrominoe tetrominoe, Point point)
 

‍If the tetrominoe is within the grid and doesn't overlap with any other tetrominoe, then return true

More...
 
int LineFull ()
 

‍If the line is full, return the line number, otherwise return -1

More...
 
void ClearLine (int line)
 

‍For each column, move all the blocks down one row, and then clear the top row

More...
 
void PrintTetrominoe (Tetrominoe t)
 For each point in the shape, add the shape's coordinates to the point, and if the point is true, set the grid's color to the shape's color. More...
 
override string ToString ()
 Covert the gid to a color string More...
 
string ToString (Tetrominoe t)
 Covert the gid to a color string with the current tetrominoe More...
 

Properties

Color[,] CGrid [get]
 
Point MinGrid [get]
 
Point MaxGrid [get]
 

Constructor & Destructor Documentation

◆ Grid()

Grid.Grid ( Color  grid[,])

‍Create a Grid object with a given grid of colors

Parameters
gridThe color grid.

Member Function Documentation

◆ CanGo()

bool Grid.CanGo ( Tetrominoe  tetrominoe,
Point  point 
)

‍If the tetrominoe is within the grid and doesn't overlap with any other tetrominoe, then return true

Parameters
TetrominoeThe tetrominoe to check if it can go to the point.
PointThe point where the tetrominoe will be placed.
Returns
A boolean value.

◆ ClearLine()

void Grid.ClearLine ( int  line)

‍For each column, move all the blocks down one row, and then clear the top row

Parameters
lineThe line to clear

◆ LineFull()

int Grid.LineFull ( )

‍If the line is full, return the line number, otherwise return -1

Returns
The y value of the first full line.

◆ PrintTetrominoe()

void Grid.PrintTetrominoe ( Tetrominoe  t)

For each point in the shape, add the shape's coordinates to the point, and if the point is true, set the grid's color to the shape's color.

Parameters
TetrominoeThe Tetrominoe to be printed.

◆ ToString() [1/2]

override string Grid.ToString ( )

Covert the gid to a color string

Returns
A string representation of the grid.

◆ ToString() [2/2]

string Grid.ToString ( Tetrominoe  t)

Covert the gid to a color string with the current tetrominoe

Parameters
TetrominoeThe tetrominoe to print.
Returns
A string representation of the grid.

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