public void refreshTab(MovableGrid oldPiece, MovableGrid newPiece) { if (oldPiece != null) { for (int i = 0; i < oldPiece.Rows(); i++) { for (int j = 0; j < oldPiece.Columns(); j++) { if (oldPiece.Y + i >= 0 && oldPiece.CellAt(i, j) != '.') { blocks[oldPiece.Y + i, oldPiece.X + j] = '.'; } } } } if (newPiece != null) { for (int i = 0; i < newPiece.Rows(); i++) { for (int j = 0; j < newPiece.Columns(); j++) { if (newPiece.Y + i >= 0 && newPiece.CellAt(i, j) != '.') { blocks[newPiece.Y + i, newPiece.X + j] = newPiece.CellAt(i, j); } } } } if (!IsFallingBlock()) { for (int row = 0; row < rows; row++) { int contain = 0; for (int col = 0; col < columns; col++) { if (blocks[row, col] != '.') { contain++; } } if (contain == columns) { DeleteRow(row); } } } }
public char StatusAt(int row, int col) { if (fallingBlock != null && fallingBlock.isAt(row, col)) { return(fallingBlock.CellAt(row, col)); } else { return(board[row, col]); } }
void CopyToBoard(MovableGrid block) { for (int r = 0; r < Rows(); r++) { for (int c = 0; c < Columns(); c++) { if (block.IsAt(r, c)) { board[r, c] = block.CellAt(r, c); } } } }
void CopyToBoard(MovableGrid block) { for (int row = 0; row < this.rows; row++) { for (int col = 0; col < this.columns; col++) { if (block.IsAt(row, col)) { this.board[row, col] = block.CellAt(row, col); } } } }
void CoptyToBoard(MovableGrid block) { for (int row = 0; row < Rows; row++) { for (int col = 0; col < Cols; col++) { if (block.isAt(row, col)) { board[row, col] = block.CellAt(row, col); } } } }
public override String ToString() { char[,] curr_board = new char[Rows(), Columns()]; for (int r = 0; r < Rows(); r++) { for (int c = 0; c < Columns(); c++) { if ((fallingBlock is object) && fallingBlock.IsAt(r, c)) { curr_board[r, c] = fallingBlock.CellAt(r, c); } else { curr_board[r, c] = board[r, c]; } } } return(StringToMatrix.Inverse(curr_board, Rows(), Columns())); }
public override String ToString() { String s = ""; for (int row = 0; row < Rows; row++) { for (int col = 0; col < Columns; col++) { if (IsFallingBlock()) { s += fallingBlock.IsAt(row, col) ? fallingBlock.CellAt(row, col) : board[row, col]; } else { s += board[row, col]; } } s += "\n"; } return(s); }