state: Added simple mode for isPhaseOver()

This commit is contained in:
2023-04-26 11:49:06 +10:00
parent 10b23e8a8c
commit e228e9551a
2 changed files with 18 additions and 1 deletions

View File

@@ -412,6 +412,23 @@ public class State {
return !resourcesLeft || !moveLeft;
}
/**
* is the phase over?
* @param simple boolean don't check all player moves
*/
public boolean isPhaseOver(boolean simple){
boolean resourcesLeft = false;
for (Resource r : resources) {
if (!r.isClaimed() && r.getType() != 'S') resourcesLeft = true;
}
boolean moveLeft = false;
if (getCurrentPlayer().canPlay(this)) moveLeft = true;
return !resourcesLeft || !moveLeft;
}
/**
* Clean board for next phase
*/