task 13 optimized for multiple players
Signed-off-by: Immanuel Alvaro Bhirawa <u7280427@anu.edu.au>
This commit is contained in:
parent
bf38979834
commit
56b29a3301
@ -670,15 +670,33 @@ public class BlueLagoon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// After the endPhase is over, move to the next player
|
// After the endPhase is over, move to the next player
|
||||||
state.nextPlayer();
|
state.nextPlayer();
|
||||||
|
|
||||||
// if the current player cannot play the move, move to the next player
|
// if the current player cannot play, go to the next player
|
||||||
if (!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
|
int players = state.getNumPlayers();
|
||||||
|
while (!state.getCurrentPlayer().canPlay(state)) {
|
||||||
|
if (players == 1) break;
|
||||||
|
state.nextPlayer();
|
||||||
|
players--;
|
||||||
|
}
|
||||||
|
|
||||||
return state.toString();
|
return state.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//upStream pull lol
|
// // Tally up the score
|
||||||
|
// else if (state.getCurrentPhase() == 'S') {
|
||||||
|
// state.scorePhase();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // After the endPhase is over, move to the next player
|
||||||
|
// state.nextPlayer();
|
||||||
|
//
|
||||||
|
// // if the current player cannot play the move, move to the next player
|
||||||
|
// if (!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
|
||||||
|
//
|
||||||
|
// return state.toString();
|
||||||
|
// }
|
||||||
/**
|
/**
|
||||||
* Given a state string, returns a valid move generated by your AI.
|
* Given a state string, returns a valid move generated by your AI.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user