added comments
This commit is contained in:
parent
a9c0c86868
commit
b8487c3c08
@ -450,6 +450,10 @@ public class Player {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the string representation of the player
|
||||||
|
* @return String representation of the player in playerString format
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String str = "p " + playerID + " " + score + " " + numCoconuts + " " + numBamboo + " " + numWater + " " + numPreciousStones + " " + numStatuette + " S";
|
String str = "p " + playerID + " " + score + " " + numCoconuts + " " + numBamboo + " " + numWater + " " + numPreciousStones + " " + numStatuette + " S";
|
||||||
|
@ -26,7 +26,7 @@ public class State {
|
|||||||
private int currentPhase; // 0 for exploration, 1 for settlement
|
private int currentPhase; // 0 for exploration, 1 for settlement
|
||||||
|
|
||||||
private Island[] islands;
|
private Island[] islands;
|
||||||
private Coord[] stonesCoords;
|
final private Coord[] stonesCoords;
|
||||||
private Resource[] resources;
|
private Resource[] resources;
|
||||||
private Player[] players;
|
private Player[] players;
|
||||||
// endregion
|
// endregion
|
||||||
@ -144,7 +144,10 @@ public class State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a player to the game
|
||||||
|
* This will add a player to the game if there is less than the maximum number of players
|
||||||
|
*/
|
||||||
public void addPlayer(){
|
public void addPlayer(){
|
||||||
if (numPlayers >= maxPlayers) return; // There are already the maximum number of players
|
if (numPlayers >= maxPlayers) return; // There are already the maximum number of players
|
||||||
Player[] oldPlayers = players;
|
Player[] oldPlayers = players;
|
||||||
@ -157,6 +160,9 @@ public class State {
|
|||||||
numPlayers++;
|
numPlayers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distribute the resources to the stone circles randomly
|
||||||
|
*/
|
||||||
public void distributeResources() {
|
public void distributeResources() {
|
||||||
if (stonesCoords.length != 32) return; // There are not enough stones to distribute resources
|
if (stonesCoords.length != 32) return; // There are not enough stones to distribute resources
|
||||||
|
|
||||||
@ -843,6 +849,10 @@ public class State {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a string representation of the score of each player
|
||||||
|
* @return String scoreString
|
||||||
|
*/
|
||||||
public String scoreString() {
|
public String scoreString() {
|
||||||
String str = "";
|
String str = "";
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
|
Loading…
Reference in New Issue
Block a user