player: Added storing if the player is AI

This commit is contained in:
Nathan Woodburn 2023-05-02 12:43:41 +10:00
parent 98e98e496c
commit 035d3bf022
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -24,6 +24,7 @@ public class Player {
private Coord[] settlers; private Coord[] settlers;
private Coord[] villages; private Coord[] villages;
private Coord lastMove; private Coord lastMove;
private Boolean isAI;
/** /**
* Constructor for Player class * Constructor for Player class
@ -40,6 +41,7 @@ public class Player {
this.numStatuette = 0; this.numStatuette = 0;
this.settlers = new Coord[0]; this.settlers = new Coord[0];
this.villages = new Coord[0]; this.villages = new Coord[0];
this.isAI = false;
lastMove = new Coord(-1, -1); lastMove = new Coord(-1, -1);
} }
// endregion // endregion
@ -231,10 +233,31 @@ public class Player {
return numPieces; return numPieces;
} }
/**
* Get the player's last move coord
* @return Coord last move coord
*/
public Coord getLastMove() { public Coord getLastMove() {
return lastMove; return lastMove;
} }
/**
* Set if the player is an AI
* @param ai boolean true if player is an AI, false otherwise
*/
public void setAI(boolean ai) {
this.isAI = ai;
}
/**
* Check if the player is an AI
* @return boolean true if player is an AI, false otherwise
*/
public boolean isAI() {
return isAI;
}
/** /**
* Check if player is able to do any moves * Check if player is able to do any moves
* @return true if player can do any moves, false otherwise * @return true if player can do any moves, false otherwise