This commit is contained in:
Louanne.Demoete 2025-04-15 11:59:20 +02:00
parent 043fdb36be
commit a2e87345fb
1 changed files with 13 additions and 14 deletions

View File

@ -7,30 +7,29 @@ public class Game extends Thread {
private AutoPlayer aiPlayer;
private Board board;
private MyInterface mjf;
private int COL_NUM = 8;
private int LINE_NUM = 8;
private int loopDelay = 250;
boolean[] activationAIFlags;
private MyInterface mjf; //Reference to GUI interface
private int COL_NUM = 8; // number of columns of a chess board
private int LINE_NUM = 8; // number of rows of a chess board
private int loopDelay = 250; // Delay in milisec between turns (AI speed)
boolean[] activationAIFlags; //Flags to enable or disable AI for white or black
public Game(MyInterface mjfParam) {
//Constructor to initialize the game with a GUI interface
public Game(MyInterface mjfParam) {
mjf = mjfParam;
board = new Board(COL_NUM, LINE_NUM);
board = new Board(COL_NUM, LINE_NUM); // create a new chess board
loopDelay = 250;
LINE_NUM = 8;
COL_NUM = 8;
activationAIFlags = new boolean[2];
aiPlayer = new AutoPlayer();
activationAIFlags = new boolean[2]; // initialize AI flags: false by default
aiPlayer = new AutoPlayer(); // create the AI player
}
// getter for the board width
public int getWidth() {
return board.getWidth();
}
//getter for the board height
public int getHeight() {
return board.getHeight();
}
// Main loop for the game thread (run continuously)
public void run() {
while(true) {
aiPlayerTurn();