This commit is contained in:
Aubin DORIVAL
2025-04-14 09:24:15 +02:00
2 changed files with 46 additions and 13 deletions

View File

@@ -29,18 +29,14 @@ public class GomokuGame {
GomokuGame(boolean renderer) {
this.playRenderer = renderer;
this.board = new GomokuBoard(15, 15);
this.board.get(7, 7).setState(Color.BLACK);
this.player1 = new Human("un", Color.WHITE, 60);
this.player2 = new GomokuAI("deux", Color.BLACK, 60);
}
public static void main(String[] args) {
int sizeX = 0;
int sizeY = 0;
int nbToken = 0;
int nbJetonsAligne = 0;
int sizeX = 15;
int sizeY = 15;
int nbToken = 50;
int nbJetonsAligne = 5;
boolean renderer = false;
String path_a_load = "";
@@ -88,6 +84,10 @@ public class GomokuGame {
}
}
GomokuGame g = new GomokuGame(false);// metre true ou fals si in veut l'affichage ou non
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);
// g.renderer.update();
g.startGame();
@@ -146,7 +146,7 @@ public class GomokuGame {
}
System.out.println(board.countMax(board.countAlignedCells(currentPlay)));
if (NB_CELL_PLAY <= board.countMax(board.countAlignedCells(currentPlay))) {
this.renderer.updateStatus("Le joueur " + this.currentPlayer + "a gagné !");
// this.renderer.updateStatus("Le joueur " + this.currentPlayer + "a gagné !");
return;
}
this.currentPlayer.tokens -= 1;
@@ -154,7 +154,8 @@ public class GomokuGame {
System.out.println(this.board);
}
this.renderer.updateStatus("Match nul, il ne reste plus de jeton.");
// this.renderer.updateStatus("Match nul, il ne reste plus de jeton.");
System.out.println("Match nul, il ne reste plus de jeton");
return;
}