public AnalyzeFactory<String> alberi(String map, int count) {
        AnalyzeFactory<String> factory = new AnalyzeFactory<String>();
        String[] lines = map.split("\\n");
        Map<Character, List<String>> groups = new HashMap<Character, List<String>>();
        for (int y = 0; y < lines.length; y++) {
            String line = lines[y];
            if (line.length() != lines.length) {
                throw new IllegalArgumentException("Map format incorrect: " + map + " expected " +
                        lines.length + " columns in row " + y + " but was " + line.length());
            }
            List<String> row = new ArrayList<String>();
            for (int x = 0; x < line.length(); x++) {
                char ch = line.charAt(x);
                addToGroup(groups, ch, x, y);
                row.add(str(x, y));
            }
            factory.addRule(new FieldRule<String>(String.valueOf("row " + y), row, count));
        }

        for (int x = 0; x < lines.length; x++) {
            List<String> col = new ArrayList<String>();
            for (int y = 0; y < lines.length; y++) {
                col.add(str(x, y));
            }
            factory.addRule(new FieldRule<String>(String.valueOf("col " + x), col, count));
        }

        for (Map.Entry<Character, List<String>> ee : groups.entrySet()) {
            factory.addRule(new FieldRule<String>(String.valueOf(ee.getKey()), ee.getValue(), count));
        }

        factory.setListener(new AlberiListener());

        return factory;
    }