From a2e87345fb8e4d679983f91705a3ec78d7e4bc53 Mon Sep 17 00:00:00 2001 From: "Louanne.Demoete" Date: Tue, 15 Apr 2025 11:59:20 +0200 Subject: [PATCH] Notes --- OOP_3B6_Project/src/backend/Game.java | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/OOP_3B6_Project/src/backend/Game.java b/OOP_3B6_Project/src/backend/Game.java index 4c64f70..bb253c0 100644 --- a/OOP_3B6_Project/src/backend/Game.java +++ b/OOP_3B6_Project/src/backend/Game.java @@ -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();