Esempio n. 1
0
 /**
  * Searches every row in Tables block array with no null values, and adds it's row-index to a
  * list.
  *
  * @param levelManager The LevelManager, whose destroyedRows is updated after collecting the
  *     correct rows.
  * @param table The Table whose rows are effected.
  * @return The list of indexes of rows with no null block -values.
  */
 public ArrayList<Integer> searchFullRows(LevelManager levelManager, Table table) {
   ArrayList<Integer> rowsToDestroy = new ArrayList<>();
   int piecesInRow = 0;
   for (int i = 0; i < table.getHeight(); i++) {
     for (int j = 0; j < table.getWidth(); j++) {
       if (table.getBlocks()[j][i] != null) {
         piecesInRow++;
       }
     }
     if (piecesInRow == table.getWidth()) {
       rowsToDestroy.add(i);
       levelManager.increaseRowsDestroyed();
     }
     piecesInRow = 0;
   }
   return rowsToDestroy;
 }