Task 13 done with the help of Nathan
Signed-off-by: Immanuel Alvaro Bhirawa <u7280427@anu.edu.au>
This commit is contained in:
parent
bd2b3477b6
commit
c4db86793c
@ -660,9 +660,9 @@ public class BlueLagoon {
|
|||||||
State state = new State(stateString);
|
State state = new State(stateString);
|
||||||
char pieceType = moveString.charAt(0);
|
char pieceType = moveString.charAt(0);
|
||||||
String coordStr = moveString.substring(2);
|
String coordStr = moveString.substring(2);
|
||||||
int x = Integer.parseInt(coordStr.split(",")[0]);
|
int y = Integer.parseInt(coordStr.split(",")[0]);
|
||||||
int y = Integer.parseInt(coordStr.split(",")[1]);
|
int x = Integer.parseInt(coordStr.split(",")[1]);
|
||||||
Coord coord = new Coord(x, y);
|
Coord coord = new Coord(y, x);
|
||||||
|
|
||||||
// if the move is valid, place it
|
// if the move is valid, place it
|
||||||
if ( isMoveValid(stateString, moveString)) state.placePiece(coord, pieceType);
|
if ( isMoveValid(stateString, moveString)) state.placePiece(coord, pieceType);
|
||||||
@ -677,7 +677,6 @@ public class BlueLagoon {
|
|||||||
state.scorePhase();
|
state.scorePhase();
|
||||||
state.cleanBoard();
|
state.cleanBoard();
|
||||||
state.distributeResources();
|
state.distributeResources();
|
||||||
// if(!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
|
|
||||||
state.nextPhase();
|
state.nextPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -685,11 +684,13 @@ public class BlueLagoon {
|
|||||||
// Tally up the score, if the current Player does not have any more move, go to next player
|
// 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();
|
state.nextPlayer();
|
||||||
|
|
||||||
|
if (!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
|
||||||
|
|
||||||
return state.toString();
|
return state.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user