2021-02-10 12:01:51 +01:00
|
|
|
package othello;
|
|
|
|
|
2021-02-23 14:28:01 +01:00
|
|
|
import othello.players.Player;
|
|
|
|
|
2021-02-10 12:01:51 +01:00
|
|
|
public class Point {
|
|
|
|
|
2021-02-20 18:54:38 +01:00
|
|
|
private int x;
|
|
|
|
private int y;
|
2021-02-10 12:01:51 +01:00
|
|
|
|
2021-02-20 18:54:38 +01:00
|
|
|
public Point(int y, int x) {
|
2021-02-10 12:01:51 +01:00
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
}
|
2021-02-22 21:17:10 +01:00
|
|
|
|
2021-02-23 14:28:01 +01:00
|
|
|
public boolean isJump(Point other, Player[][] board) {
|
|
|
|
return (board[(x+other.getX())/2][(y+other.getY())/2] != null);
|
2021-02-10 12:01:51 +01:00
|
|
|
}
|
2021-02-12 09:57:05 +01:00
|
|
|
|
2021-02-10 13:01:47 +01:00
|
|
|
public int getX(){
|
|
|
|
return x;
|
|
|
|
}
|
2021-02-12 09:57:05 +01:00
|
|
|
|
2021-02-10 13:01:47 +01:00
|
|
|
public int getY(){
|
|
|
|
return y;
|
|
|
|
}
|
2021-02-10 12:01:51 +01:00
|
|
|
|
2021-02-10 13:35:22 +01:00
|
|
|
@Override
|
|
|
|
public String toString () {
|
2021-02-20 18:54:38 +01:00
|
|
|
return "(" + y + ", " + x + ")";
|
2021-02-10 13:35:22 +01:00
|
|
|
}
|
|
|
|
|
2021-02-10 12:01:51 +01:00
|
|
|
}
|