public static int floodFill(State s) {
        // Initialization
        Queue<Position> fringe = new LinkedList<>();
        Set<Position> visitedStates = new HashSet<>();

        fringe.add(s.player);
        visitedStates.add(s.player);

        while (fringe.size() > 0) {
            //Pop new state
            Position state = fringe.poll();
            //Expand the state
            List<Position> nextStates = new ArrayList<>();
            for (int i = 0; i < 4; i++) {
                Position newP = new Position(state.getRow() + MOVE_Y[i], state.getCol() + MOVE_X[i]);
                if (isValidPosition(newP) && isEmptyPosition(newP) && !s.boxes.contains(newP)) {
                    nextStates.add(newP);
                }
            }
            for (Position p : nextStates) {
                if (!visitedStates.contains(p)) //Add next States to the fringe if they are not visited
                {
                    fringe.add(p);
                    visitedStates.add(p);
                }
            }
        }//end while        

        /*Now we have all the reachable positions on the visitedStates list*/
        int result = 0;
        for (Position p : visitedStates) {
            result += 3 * p.getRow() + 7 * p.getCol();
        }
        return result;
    }