Merge branch 'master' of https://forge.info.unicaen.fr/git/othello
This commit is contained in:
commit
8f15a25eec
@ -13,6 +13,12 @@ public class Point {
|
||||
public boolean isJump(Point other) {
|
||||
return Math.pow(other.x - this.x, 2) + Math.pow(other.y - this.y, 2) == 4;
|
||||
}
|
||||
public int getX(){
|
||||
return x;
|
||||
}
|
||||
public int getY(){
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString () {
|
||||
|
@ -65,15 +65,16 @@ public class State {
|
||||
return currentPlayer == player1 ? n1/(n1+n2) : n2/(n2+n1);
|
||||
}
|
||||
|
||||
public State play(int x, int y) {
|
||||
public State play(Pair<Point,Point> paire) {
|
||||
State copy = this.copy();
|
||||
copy.board[x][y] = copy.getCurrentPlayer();
|
||||
copy.board[paire.getLeft.getX][paire.getLeft.getY] = copy.getCurrentPlayer();
|
||||
int increment = 0;
|
||||
for(int i = -1; i<2;i++){
|
||||
for(int z = -1;z<2;z++){
|
||||
try {
|
||||
copy.board[x+i][y+z] = copy.getCurrentPlayer();
|
||||
if(copy.board[paire.getLeft.getX+i][paire.getLeft.getY+z] != copy.getCurrentPlayer()){
|
||||
increment++;
|
||||
copy.board[paire.getLeft.getX+i][paire.getLeft.getY+z] = copy.getCurrentPlayer();
|
||||
} catch (IndexOutOfBoundsException ignored) {}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user