private Field checkAndAdd(List<Field> queue, List<Field> env, Field f) {
        for (Field t : env) {
            if (!used[t.getPosition()] && t.isEmpty() && !(t instanceof BorderField)) {
                used[t.getPosition()] = true;
                queue.add(t);
                predecessor[t.getPosition()] = f;
            } else if (checkSearchObject(t)) {
                predecessor[t.getPosition()] = f;
                return t;
            }
        }
        return null;
    }