cleaned task 13 but still dont know what caused the testEdgeCaseGames test to fail.

Signed-off-by: Immanuel Alvaro Bhirawa <u7280427@anu.edu.au>
This commit is contained in:
Immanuel Alvaro Bhirawa 2023-05-09 02:50:23 +10:00
parent 28b0288e8a
commit bd2b3477b6

View File

@ -664,16 +664,25 @@ public class BlueLagoon {
int y = Integer.parseInt(coordStr.split(",")[1]); int y = Integer.parseInt(coordStr.split(",")[1]);
Coord coord = new Coord(x, y); Coord coord = new Coord(x, y);
// if the move is valid, place it
if ( isMoveValid(stateString, moveString)) state.placePiece(coord, pieceType); if ( isMoveValid(stateString, moveString)) state.placePiece(coord, pieceType);
// while (!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
// if the move ends the phase
if (state.isPhaseOver()){ if (state.isPhaseOver()){
// Applying end of Phase rules
// For Exploration Phase
// Tally up the score, clean the board, distribute resources, change to next Phase
if (state.getCurrentPhase() == 'E') { if (state.getCurrentPhase() == 'E') {
state.scorePhase(); state.scorePhase();
state.cleanBoard(); state.cleanBoard();
state.distributeResources(); state.distributeResources();
// if(!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
state.nextPhase(); state.nextPhase();
} }
// For Settlement Phase
// Tally up the score, if the current Player does not have any more move, go to next player
else if (state.getCurrentPhase() == 'S') { else if (state.getCurrentPhase() == 'S') {
state.scorePhase(); state.scorePhase();
state.nextPlayer(); state.nextPlayer();