I am trying to create a version of Conway's Game of Life in Java, where after each iteration, the console is updated in some way to imitate the next generation.
I have seen Runtime.getRuntime().exec("cls");
but that clears the console and creates a black screen delay between iterations, which is visually annoying.
Using @Holger 's info from this answer,
public class CLS {
public static void main(String... arg) throws IOException, InterruptedException {
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
}
}
I am more wondering if there is a way to make it smoother. For example, the updating mechanic requires the entire console data to be removed, which causes a momentary black screen that is distracting. Is there a way to update the console without clearing?
Please let me know if you can think of any workaround or better way of solving this problem!