task 9 and 10: Added using state class

This commit is contained in:
2023-04-24 17:36:20 +10:00
parent 8ed19d75bd
commit 899497d037
5 changed files with 107 additions and 12 deletions

View File

@@ -558,13 +558,12 @@ public class State {
* @return int score
*/
public int scoreStatuettes(int playerID) {
int score = 0;
return score; //! TODO
return players[playerID].getNumResource('S') * 4;
}
// endregion
// region String conversion
@Override
public String toString() {
String str = "a " + boardHeight + " " + getNumPlayers() + "; c " + getCurrentPlayerID() + " " + getCurrentPhase() + "; ";
@@ -581,7 +580,7 @@ public class State {
for (char type : types) {
str += " " + type;
for (Resource resource : resources) {
if (resource.getType() == type) str += " " + resource.getCoord().toString();
if (resource.getType() == type && !resource.isClaimed()) str += " " + resource.getCoord().toString();
}
}
str += ";";
@@ -591,4 +590,14 @@ public class State {
return str;
}
public String scoreString() {
String str = "";
for (Player player : players) {
str += "Player " + player.getPlayerID() + "'s score is " + player.getScore() + "\n";
}
return str.substring(0, str.length() - 1);
}
// endregion
}