From 042a5dc9ea3555b7ac54b556e461010c797ce786 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 12 Feb 2021 09:02:53 +0100 Subject: [PATCH] fixed errors --- src/othello/State.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/othello/State.java b/src/othello/State.java index 9920d81..128ab9a 100644 --- a/src/othello/State.java +++ b/src/othello/State.java @@ -65,16 +65,17 @@ public class State { return currentPlayer == player1 ? n1/(n1+n2) : n2/(n2+n1); } - public State play(Pair paire) { + public State play(Pair pair) { State copy = this.copy(); - copy.board[paire.getLeft.getX][paire.getLeft.getY] = copy.getCurrentPlayer(); + copy.board[pair.getLeft().getX()][pair.getLeft().getY()] = copy.getCurrentPlayer(); int increment = 0; for(int i = -1; i<2;i++){ for(int z = -1;z<2;z++){ try { - if(copy.board[paire.getLeft.getX+i][paire.getLeft.getY+z] != copy.getCurrentPlayer()){ + if(copy.board[pair.getLeft().getX() + i][pair.getLeft().getY() + z] != copy.getCurrentPlayer()){ increment++; - copy.board[paire.getLeft.getX+i][paire.getLeft.getY+z] = copy.getCurrentPlayer(); + copy.board[pair.getLeft().getX() + i][pair.getLeft().getY() + z] = copy.getCurrentPlayer(); + } } catch (IndexOutOfBoundsException ignored) {} } }