int maxMoves = -1;
String maxSolution = "";
for (int i = 1; i <= numGames; ++i) {
theBoard.setRobotsRandom();
final Solver theSolver = Solver.createInstance(theBoard);
final Solution theSolution = theSolver.execute().get(0);
final int moves = theSolution.size();
//System.err.println(i + " usedMem=" + (getBytesUsed() >> 20) + " MiB " + theSolver.getKnownStatesNumber());
if ((0 == i % 100) || (moves > maxMoves)) {
String msg = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
msg += " gamesSolved=" + i + "/" + numGames + " maxMoves=" + (moves > maxMoves ? moves : maxMoves);
System.out.println(msg);
}
if (moves > maxMoves) {
maxMoves = moves;
maxSolution = theBoard.toString() + "\n" + theSolver.toString() + '\n';
System.out.println(maxSolution);
} else {
System.out.println("\n***** run #" + i + " - current maxMoves still is " + maxMoves + " *****\n");
}
}