state: Added simple mode for isPhaseOver()
This commit is contained in:
parent
10b23e8a8c
commit
e228e9551a
@ -538,7 +538,7 @@ public class BlueLagoon {
|
|||||||
*/
|
*/
|
||||||
public static boolean isPhaseOver(String stateString){
|
public static boolean isPhaseOver(String stateString){
|
||||||
State state = new State(stateString);
|
State state = new State(stateString);
|
||||||
return state.isPhaseOver();
|
return state.isPhaseOver(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -412,6 +412,23 @@ public class State {
|
|||||||
return !resourcesLeft || !moveLeft;
|
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
|
* Clean board for next phase
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user