public void startGame() {
    hasStarted = true;

    // reset grid
    gridManager.clearGrid();

    // generate random piece
    currentPiece = pieceGenerator.getRandomPiece();

    // set pieceController to currentPiece
    pieceController.setCurrentTetrisPiece(currentPiece);

    pieceController.placeCurrentTetrisPieceAt(2, 2);

    // other stuff like clearing levels and score.
  }
  public boolean[][] startGameLoop() {
    if (!hasStarted()) startGame();
    else {
      // piece either collided with another piece or has reached bottom
      if (hasCollision()) {
        // some check to see if there are any filled rows.
        // then perform a collapse on the grid

        // do next iteration.
        performNextIteration();
      } else {
        // retrieve action.
        Actions userAction = getCurrentAction();

        // perform the action
        performAction(userAction);
      }
    }

    return gridManager.getGridInfo();
  }
 private boolean hasCollided() {
   return gridManager.hasCollidedBelow(currentPiece.getBlocks());
 }
 // get copy of data of grid for reference.
 public boolean[][] getPieceData() {
   return gridManager.getGridInfo();
 }