cleaned task 13 a bit but still dont know what this edge case error is lol

Signed-off-by: Immanuel Alvaro Bhirawa <u7280427@anu.edu.au>
This commit is contained in:
Immanuel Alvaro Bhirawa 2023-05-09 01:54:22 +10:00
parent 0f203df939
commit 28b0288e8a

View File

@ -665,6 +665,7 @@ public class BlueLagoon {
Coord coord = new Coord(x, y);
if ( isMoveValid(stateString, moveString)) state.placePiece(coord, pieceType);
// while (!state.getCurrentPlayer().canPlay(state)) state.nextPlayer();
if (state.isPhaseOver()){
if (state.getCurrentPhase() == 'E') {
@ -680,79 +681,9 @@ public class BlueLagoon {
}
state.nextPlayer();
// while (!state.getCurrentPlayer().canPlay(state)) {
// state.nextPlayer();
// }
return state.toString();
}
// /**
// * Get the current phase
// * Returns 'E' for exploration, 'S' for settlement, 'O' for game over
// * @return char current phase
// */
// public char getCurrentPhase() {
// if (currentPhase == 0) return 'E';
// else if (currentPhase == 1) return 'S';
// else return 'O'; // Return 'O' for game over
// }
//* A phase is over when either of the following conditions hold:
// * - All resources (not including statuettes) have been collected.
// * - No player has any remaining valid moves.
///**
// * Given a state string, determine whether it represents an end of phase state.
// * <p>
// * A phase is over when either of the following conditions hold:
// * - All resources (not including statuettes) have been collected.
// * - No player has any remaining valid moves.
// *
// * @param stateString a string representing a game state
// * @return true if the state is at the end of either phase and false otherwise
// */
// public static boolean isPhaseOver(String stateString){
// State state = new State(stateString);
// return state.isPhaseOver();
// }
///**
// * Score for that phase
// * This does not automatically move to the next phase
// */
// public void scorePhase() {
// for (Player p: players) {
// p.addScore(createScore(p.getPlayerID()));
// }
// }
///**
// * Place a piece on the board. Uses current turn's player
// * This does not check if the move is valid (Use isValidMove() first)
// * @param coord Coord coordinate to place piece
// * @param type char type of piece
// */
// public void placePiece(Coord coord, char type) {
// if (type == 'S') {
// players[currentPlayer].addSettler(coord);
// }
// else if (type == 'V' || type == 'T') {
// players[currentPlayer].addVillage(coord);
// }
//
// // Claim resource if it is a stone circle
// if (isStone(coord)) {
// for (Resource resource : resources) {
// if (resource.getCoord().equals(coord) && resource.isAvailable()) {
// players[currentPlayer].addResource(1, resource.getType());
// resource.setClaimed();
// }
// }
// }
// }
/**
* Given a state string, returns a valid move generated by your AI.
* <p>