diff --git a/src/ConsoleRenderer.java b/src/ConsoleRenderer.java index bcc15a7..a3ee8ff 100644 --- a/src/ConsoleRenderer.java +++ b/src/ConsoleRenderer.java @@ -1,6 +1,15 @@ public class ConsoleRenderer extends GomokuRenderer { + // Color constants + public static final String RESET = "\u001B[0m"; + public static final String BOLD = "\u001B[1m"; + public static final String COLOR_RED = "\u001B[31m"; + public static final String COLOR_GREEN = "\u001B[32m"; + public static final String COLOR_GRAY = "\u001B[38;5;240m"; + + public static final String CLEAR_TERM = "\033[H\033[2J"; + public ConsoleRenderer() { } @@ -15,11 +24,12 @@ public class ConsoleRenderer extends GomokuRenderer { // Print the board to the console // Clear the console - System.out.print("\033[H\033[2J"); + System.out.print(CLEAR_TERM); System.out.flush(); String[] board = game.getBoard().toString().split("\n"); - String horizontalLine = getHorizontalLine(); + String horizontalLine = getHorizontalLine(RESET); + String horizontalLineGray = getHorizontalLine(COLOR_GRAY); int width = game.getBoard().getWidth(); int height = game.getBoard().getHeight(); @@ -31,23 +41,25 @@ public class ConsoleRenderer extends GomokuRenderer { System.out.println(horizontalLine); for (int i = 0; i < height; i++) { System.out.print("|"); - + for (int j=0; j