private static boolean stop = false;
public static void main(String args[]) throws Exception {
getArguments(args);
final EvolutionChamber ec = new EvolutionChamber();
ec.setDestination(inputFile.getDestination());
ec.setThreads(threads);
ec.setReportInterface(new EcReportable() {
@Override
public void threadScore(int threadIndex, String output) {
}
@Override
public synchronized void bestScore(EcState finalState, int intValue, String detailedText, String simpleText, String yabotText) {
//only output complete builds
boolean isSatisfied = detailedText.contains(EcSwingXMain.messages.getString("Satisfied"));
if (isSatisfied) {
lastDetailed = detailedText;
lastYabot = yabotText;
if (!onlyOutputFinal) {
System.out.println(detailedText);
if (printYabot) {
System.out.println(yabotText);
}
}
}
}
});
Timer ageTimer = new Timer(200, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (maxAge > 0) {
int oldThreads = 0;
for (int i = 0; i < ec.getThreads(); i++) {
int age = ec.getEvolutionsSinceDiscovery(i);
if (age > maxAge) {
oldThreads++;
}
}
if (oldThreads == ec.getThreads()) {
stop = true;
}
}
if (timeLimit > 0) {
double runningMinutes = (System.currentTimeMillis() - startTime) / 1000.0 / 60.0;
if (runningMinutes > timeLimit) {
stop = true;
}
}
}
});
startTime = System.currentTimeMillis();
ec.go();
ageTimer.start();
while (!stop) {
Thread.sleep(200);
}
ageTimer.stop();
ec.stopAllThreads();
if (lastDetailed == null) {
System.out.println(messages.getString("cli.noBuild"));
} else {
if (onlyOutputFinal) {
System.out.println(lastDetailed);