import jade.Boot;
import java.io.File;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        File folder = new File("src/agents");
        ArrayList<String> argList = new ArrayList<>();
        int whichOne = 0;

        argList.add("-gui");

        StringBuilder agentsBuilder = new StringBuilder();

        for (File file : folder.listFiles()) {
            String fileName = file.getName();

            if (fileName.endsWith(".java")) {
                String className = fileName.replace(".java", "");

                if (whichOne > 0) {
                    agentsBuilder.append(";");
                }

                agentsBuilder.append("agent")
                        .append(whichOne++)
                        .append(":agents.")
                        .append(className);
            }
        }

        // Add ALL agents as ONE argument
        argList.add(agentsBuilder.toString());

        String[] jadeArgs = argList.toArray(new String[0]);
        Boot.main(jadeArgs);
    }
}
