Adde main

This commit is contained in:
Quentin Legot 2021-01-27 12:24:17 +01:00
parent fe8be4dc57
commit b9d9afbe51
2 changed files with 41 additions and 0 deletions

25
src/othello/Main.java Normal file
View File

@ -0,0 +1,25 @@
package othello;
public class Main {
public static void main(String[] args) {
String p1 = "B", p2 = "R";
String[][] board = initialize(p1, p2);
State game = new State(board, p1, p2);
while(!game.isOver()) {
String player = game.getCurrentPlayer();
}
}
public static String[][] initialize(String p1, String p2){
String[][] board = new String[7][7];
board[0][0] = p2;
board[0][6] = p1;
board[6][0] = p1;
board[6][6] = p2;
return board;
}
}

View File

@ -3,6 +3,18 @@ package othello;
public class State { public class State {
private int[][] plateau; private int[][] plateau;
private String[][] board;
private String player1;
private String player2;
private String currentPlayer;
public State(String[][] board, String p1, String p2) {
this.board = board;
this.player1 = p1;
this.player2 = p2;
currentPlayer = p1;
}
public boolean isOver() { public boolean isOver() {
return false; return false;
} }
@ -18,5 +30,9 @@ public class State {
public void play(int move) { public void play(int move) {
} }
public String getCurrentPlayer() {
return currentPlayer;
}
} }