fixed errors

This commit is contained in:
Quentin Legot 2021-02-12 09:02:53 +01:00
parent 8f15a25eec
commit 042a5dc9ea

View File

@ -65,16 +65,17 @@ public class State {
return currentPlayer == player1 ? n1/(n1+n2) : n2/(n2+n1); return currentPlayer == player1 ? n1/(n1+n2) : n2/(n2+n1);
} }
public State play(Pair<Point,Point> paire) { public State play(Pair<Point,Point> pair) {
State copy = this.copy(); 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; int increment = 0;
for(int i = -1; i<2;i++){ for(int i = -1; i<2;i++){
for(int z = -1;z<2;z++){ for(int z = -1;z<2;z++){
try { 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++; 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) {} } catch (IndexOutOfBoundsException ignored) {}
} }
} }