From bd2b3477b67a36da01a0700e2db2a2542f9f9031 Mon Sep 17 00:00:00 2001 From: Immanuel Alvaro Bhirawa Date: Tue, 9 May 2023 02:50:23 +1000 Subject: [PATCH] cleaned task 13 but still dont know what caused the `testEdgeCaseGames` test to fail. Signed-off-by: Immanuel Alvaro Bhirawa --- src/comp1110/ass2/BlueLagoon.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/comp1110/ass2/BlueLagoon.java b/src/comp1110/ass2/BlueLagoon.java index 77ab088..0d97cf0 100644 --- a/src/comp1110/ass2/BlueLagoon.java +++ b/src/comp1110/ass2/BlueLagoon.java @@ -664,16 +664,25 @@ public class BlueLagoon { int y = Integer.parseInt(coordStr.split(",")[1]); Coord coord = new Coord(x, y); + // if the move is valid, place it if ( isMoveValid(stateString, moveString)) state.placePiece(coord, pieceType); - // while (!state.getCurrentPlayer().canPlay(state)) state.nextPlayer(); + // if the move ends the phase 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') { state.scorePhase(); state.cleanBoard(); state.distributeResources(); + // if(!state.getCurrentPlayer().canPlay(state)) state.nextPlayer(); 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') { state.scorePhase(); state.nextPlayer();