Notes
This commit is contained in:
parent
043fdb36be
commit
a2e87345fb
|
|
@ -7,30 +7,29 @@ public class Game extends Thread {
|
||||||
private AutoPlayer aiPlayer;
|
private AutoPlayer aiPlayer;
|
||||||
private Board board;
|
private Board board;
|
||||||
|
|
||||||
private MyInterface mjf;
|
private MyInterface mjf; //Reference to GUI interface
|
||||||
private int COL_NUM = 8;
|
private int COL_NUM = 8; // number of columns of a chess board
|
||||||
private int LINE_NUM = 8;
|
private int LINE_NUM = 8; // number of rows of a chess board
|
||||||
private int loopDelay = 250;
|
private int loopDelay = 250; // Delay in milisec between turns (AI speed)
|
||||||
boolean[] activationAIFlags;
|
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;
|
mjf = mjfParam;
|
||||||
board = new Board(COL_NUM, LINE_NUM);
|
board = new Board(COL_NUM, LINE_NUM); // create a new chess board
|
||||||
loopDelay = 250;
|
loopDelay = 250;
|
||||||
LINE_NUM = 8;
|
activationAIFlags = new boolean[2]; // initialize AI flags: false by default
|
||||||
COL_NUM = 8;
|
aiPlayer = new AutoPlayer(); // create the AI player
|
||||||
activationAIFlags = new boolean[2];
|
|
||||||
aiPlayer = new AutoPlayer();
|
|
||||||
}
|
}
|
||||||
|
// getter for the board width
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return board.getWidth();
|
return board.getWidth();
|
||||||
}
|
}
|
||||||
|
//getter for the board height
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return board.getHeight();
|
return board.getHeight();
|
||||||
}
|
}
|
||||||
|
// Main loop for the game thread (run continuously)
|
||||||
public void run() {
|
public void run() {
|
||||||
while(true) {
|
while(true) {
|
||||||
aiPlayerTurn();
|
aiPlayerTurn();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue