public void attackClosestUnit() {
        ArrayList<Cell> attackableCells = getAttackableCells(map);

        if (attackableCells.size() == 0) {
            map.resetPreviousCells();

            Queue<Cell> queue = new LinkedList<Cell>();
            queue.add(this.getCell());

            ArrayList<Cell> expandedNodes = new ArrayList<Cell>();

            Cell c = attackClosestUnit_(queue, expandedNodes);

            ArrayList<Cell> moveableCells = getMoveableCells(map);

            if (c != null) {
                boolean loop = true;
                while (loop && !moveableCells.contains(c)) {
                    if (c.getPreviousCell() == null) {
                        loop = false;
                    } else {
                        c = c.getPreviousCell();
                    }
                }
            }

            if (c != null) {
                this.moveToCell(this, this.getCell(), c, true);
            }
            map.resetPreviousCells();
        } else {
            Cell attackCell = attackableCells.get(0);
            if (attackCell.getBuilding() != null) {
                this.attackBuilding(this, attackCell.getBuilding(), true);
            } else if (attackCell.getUnit() != null) {
                this.attackUnit(this, attackCell.getUnit(), true);
            }
        }
    }