Cup

Cup content

Coordinates are relative to bottom left corner.

Members

Functions

destroyFullRows
int destroyFullRows()

destroy all full rows, saving flags for destroyed rows; returns count of destroyed rows, 0 if no rows destroyed

dropNextFigure
bool dropNextFigure()

New figure: put it on top of cup

genNextFigure
void genNextFigure()

random next figure

init
void init(int cols, int rows)

inits empty cup of specified size

isCellFalling
bool isCellFalling(int col, int row)

return true if cell is currently falling

isPositionFree
bool isPositionFree(in FigurePosition pos)

check if all cells where specified figure is located are free

isPositionFree
bool isPositionFree()

check if all cells where current figire is located are free

isPositionFreeBelow
bool isPositionFreeBelow()

check if all cells where current figire is located are free

isRowFull
bool isRowFull(int row)

returns true if specified row is full

markFallingCells
bool markFallingCells()

mark cells in _cellGroups[] matrix which can fall down (value > 0 is distance to fall)

move
bool move(int deltaX, int deltaY, bool falling)

try to move current figure, returns true if figure rotated

moveFallingCells
bool moveFallingCells()

moves all falling cells one cell down returns true if there are more cells to fall

opIndex
int opIndex(int col, int row)

returns cell content at specified position

opIndexAssign
void opIndexAssign(int value, int col, int row)

set cell value

putFigure
void putFigure()

put current figure into cup at current position and orientation

rotate
bool rotate(int angle, bool falling)

try to rotate current figure, returns true if figure rotated

Properties

cols
int cols [@property getter]

returns number of columns

currentFigure
FigurePosition currentFigure [@property getter]

current figure index, orientation, position

hasFullRows
bool hasFullRows [@property getter]

returns true if at least one row is full

hasNextFigure
bool hasNextFigure [@property getter]

returns true if next figure is generated

nextFigure
FigurePosition nextFigure [@property getter]

next figure

rows
int rows [@property getter]

returns number of columns

Meta