From 2959e4cafa6c420dc6c46aa26d51ff744557adaf Mon Sep 17 00:00:00 2001 From: Aubin DORIVAL Date: Mon, 14 Apr 2025 10:30:24 +0200 Subject: [PATCH] main --- src/GomokuGame.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/GomokuGame.java b/src/GomokuGame.java index 636f875..f2fe664 100644 --- a/src/GomokuGame.java +++ b/src/GomokuGame.java @@ -11,7 +11,7 @@ public class GomokuGame { public static final int DEFAULT_BOARD_WIDTH = 15; // largeur du plateau public static final int DEFAULT_BOARD_HEIGHT = 15; // hauteur du plateau public static final int DEFAULT_TOKENS_COUNT = 60; // nb de jetons - public static final int NB_CELL_PLAY = 5; // nb de jetons + public int NB_CELL_PLAY = 5; // nb de jetons private Player player1; private Player player2; @@ -83,14 +83,19 @@ public class GomokuGame { break; } } + if (sizeY < 3 || sizeX < 3) { + System.out.println("Board is too small !"); + return; + } GomokuGame g = new GomokuGame(false);// metre true ou fals si in veut l'affichage ou non g.renderer = new ConsoleRenderer(); + g.NB_CELL_PLAY = nbJetonsAligne; g.renderer.init(g); g.board = new GomokuBoard(sizeX, sizeY); g.board.get(sizeX / 2, sizeY / 2).setState(Color.BLACK); g.player1 = new Human("un", Color.WHITE, nbToken); g.player2 = new GomokuAI("deux", Color.BLACK, nbToken - 1); - //System.out.println(g.board); + // System.out.println(g.board); // g.renderer.update(); g.startGame(); @@ -156,7 +161,7 @@ public class GomokuGame { this.currentPlayer.tokens -= 1; this.currentPlayer = this.nextPlayer(); renderer.update(); - //System.out.println(this.board); + // System.out.println(this.board); } // this.renderer.updateStatus("Match nul, il ne reste plus de jeton.");