couleur et affichage

This commit is contained in:
Cyprien111
2025-04-14 09:36:45 +02:00
parent 0b7eea162d
commit 87aee9b1d7
2 changed files with 16 additions and 6 deletions

View File

@@ -29,17 +29,27 @@ public class ConsoleRenderer extends GomokuRenderer {
System.out.println(horizontalLine); System.out.println(horizontalLine);
for (int i = 0; i < height; i++) { for (int i = 0; i < height; i++) {
System.out.print("|"); System.out.print("|");
System.out.print(board[i]); for (int j=0; j<width; j++) {
System.out.println("|"); System.out.print(" "+board[i].charAt(j)+" |");
}
System.out.println(" "+i);
System.out.println(horizontalLine);
}
System.out.print(" ");
for (int i = 0; i < height; i++) {
if(i<10) {
System.out.print(" "+i+" ");
} else {
System.out.print(" "+i+" ");
}
} }
System.out.println(horizontalLine);
} }
private String getHorizontalLine() { private String getHorizontalLine() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("+"); sb.append("+");
for (int i = 0; i < game.getBoard().getWidth(); i++) { for (int i = 0; i < game.getBoard().getWidth()*4-1; i++) {
sb.append("-"); sb.append("-");
} }
sb.append("+"); sb.append("+");

View File

@@ -226,10 +226,10 @@ public class GomokuGame {
char c; char c;
switch (board.get(i, j).getState()) { switch (board.get(i, j).getState()) {
case BLACK: case BLACK:
c = 'X'; c = '\u274C';
break; break;
case WHITE: case WHITE:
c = 'O'; c = '\uD83D';
break; break;
case NIL: case NIL:
c = '.'; c = '.';