/** * Gets the tiles that need to be deleted due to the detonating of the hypercube gem. * * @param t1 the hypercube gem * @return tiles, the list of tiles to be deleted. */ public List<Tile> getTilesToDeleteHypercube(Tile t1, Tile hyper) { List<Tile> tiles = new ArrayList<Tile>(); tiles.add(hyper); hyper.detonate = true; int index = t1.getIndex(); Tile tempTile = null; for (int row = 0; row < board.getWidth(); row++) { // loop through board for (int col = 0; col < board.getHeight(); col++) { tempTile = board.getTileAt(row, col); if (index == tempTile.getIndex() && !tempTile.detonate) { // add tile tile if colors are the same tiles.add(tempTile); } } } return tiles; }
/** * Gets the tiles that need to be deleted due to the detonating of the hypercube gem. * * @param tile the hypercube gem * @return tiles, the list of tiles to be deleted. */ public List<Tile> getTilesToDeleteStar(Tile tile) { List<Tile> tiles = new ArrayList<Tile>(); tile.detonate = true; tiles.add(tile); int tx = tile.getX(); int ty = tile.getY(); for (int col = 0; col < board.getHeight(); col++) { if (col != tx && !board.getTileAt(col, ty).detonate) { tiles.add(board.getTileAt(col, ty)); } } for (int row = 0; row < board.getWidth(); row++) { if (row != ty && !board.getTileAt(tx, row).detonate) { tiles.add(board.getTileAt(tx, row)); } } checkForSpecialTile(tiles); return tiles; }