diff --git a/src/othello/State.java b/src/othello/State.java index 28259ee..7dcca67 100644 --- a/src/othello/State.java +++ b/src/othello/State.java @@ -1,14 +1,15 @@ package othello; +import java.util.ArrayList; + public class State { - private int[][] plateau; - private String[][] board; - private String player1; - private String player2; - private String currentPlayer; + private int[][] board; + private int player1; + private int player2; + private int currentPlayer; - public State(String[][] board, String p1, String p2) { + public State(int[][] board, int p1, int p2) { this.board = board; this.player1 = p1; this.player2 = p2; @@ -19,20 +20,46 @@ public class State { return false; } - public void getMove(String player) { - + public ArrayList getMove(String player) { + return null; } public int getScore(String player) { return 0; } - public void play(int move) { - + public State play(int x, int y) { + State copie = this.copie(); + copie.board[x][y] = copie.getCurrentPlayer(); + copie.switchPlayer(); + return copie; } - public String getCurrentPlayer() { + public int getCurrentPlayer() { return currentPlayer; } + public void setCurrentPlayer(int currentPlayer) { + this.currentPlayer = currentPlayer; + } + + public State copie () { + State copie = new State (this.board, this.player1, this.player2); + for (int i=0; i