From b9d9afbe51aee301a65274d7b32065cfebef56eb Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 27 Jan 2021 12:24:17 +0100 Subject: [PATCH] Adde main --- src/othello/Main.java | 25 +++++++++++++++++++++++++ src/othello/State.java | 16 ++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/othello/Main.java diff --git a/src/othello/Main.java b/src/othello/Main.java new file mode 100644 index 0000000..860769b --- /dev/null +++ b/src/othello/Main.java @@ -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; + } + +} diff --git a/src/othello/State.java b/src/othello/State.java index 37969bc..28259ee 100644 --- a/src/othello/State.java +++ b/src/othello/State.java @@ -3,6 +3,18 @@ package othello; public class State { 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() { return false; } @@ -18,5 +30,9 @@ public class State { public void play(int move) { } + + public String getCurrentPlayer() { + return currentPlayer; + } }