blueLagoon: Pointed scoring to state object

This commit is contained in:
2023-04-24 17:53:07 +10:00
parent 899497d037
commit da04d53092
3 changed files with 48 additions and 125 deletions

View File

@@ -350,6 +350,13 @@ public class State {
if (currentPlayer >= numPlayers) currentPlayer = 0;
}
/**
* Start next phase
*/
public void nextPhase() {
currentPhase++;
}
/**
* Place a piece on the board. Uses current turn's player
* @param coord Coord coordinate to place piece
@@ -400,28 +407,14 @@ public class State {
/**
* Score for that phase
* This does not automatically move to the next phase
*/
public void scorePhase() {
for (Player p: players) {
p.addScore(createScore(p.getPlayerID()));
}
if (getCurrentPhase() == 'E') {
currentPhase++;
}
else {
// Game over
finalScore();
currentPhase++;
}
}
/**
* Final score
*
*/
public void finalScore() {
}
/**
* Get score of player ID based on current phase and game state
* @param playerID int player ID base 0
@@ -429,14 +422,11 @@ public class State {
*/
public int createScore(int playerID) {
int score = 0;
if (getCurrentPhase() == 'E') {
// Score exploration phase
score += scoreTotalIslands(playerID);
score += scoreMajorities(playerID);
}
else {
}
score += scoreTotalIslands(playerID);
score += scoreLinks(playerID);
score += scoreMajorities(playerID);
score += scoreResources(playerID);
score += scoreStatuettes(playerID);
return score;
}
@@ -484,7 +474,7 @@ public class State {
for (Island island:islands){
int[] playerPieces = new int[getNumPlayers()];
for (int i = 0; i < getNumPlayers()-1; i++){
for (int i = 0; i < getNumPlayers(); i++){
playerPieces[i] = players[i].getNumPiecesOnIsland(island);
}
boolean ishighest = true;