public int calculateCharge(int startingX, int startingY,int endingX,
           int endingY, final LinkedList<CellDescription> map) {

      /*initialize some variables*/
      int chargeRequiredForReturnTrip;
      graphics = false;
      LinkedList<CellDescription> returnCells = new LinkedList<>();
      sX = startingX;
      sY = startingY;
      eX = endingX;
      eY = endingY;
      localMap = map;
      openList = new LinkedList<>();
      closedList = new LinkedList<>();

      generateOpenAndClosedLists();

       /*calcualte battery charge by tracing the return path following the
        * parent cell back to starting coordinate*/
      returnCells.addLast(closedList.getLast().cd);
      BatteryAndDirtBin badb = new BatteryAndDirtBin(closedList.getLast().cd.sI.floor);
      Cell tempC = closedList.getLast();
      int tempx;
      int tempy;
      do {

         tempx = tempC.parentX;
         tempy = tempC.parentY;

         for (int i = 0; i < closedList.size(); i++) {
            if (tempx == closedList.get(i).cd.locX
                    && tempy == closedList.get(i).cd.locY) {
               returnCells.addLast(closedList.get(i).cd);
               badb.moved(closedList.get(i).cd.sI.floor);
               tempC = closedList.get(i);
               break;
            }
         }
      } while (tempx != sX || tempy != sY);

      chargeRequiredForReturnTrip = 500 - badb.charge();
      return chargeRequiredForReturnTrip;
   }