Skip to content

Commit

Permalink
Added Location property to Piece
Browse files Browse the repository at this point in the history
  • Loading branch information
john committed Apr 20, 2016
1 parent 5913738 commit 1c1906d
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/model/Piece.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

public class Piece {
public final Color color;
private int x;
private int y;
private Location location;
private Type type;

public Piece(Color color, int x, int y) {
public Piece(Color color, int row, int col) {
this.color = color;
this.x = x;
this.y = y;
this.location = new Location(row, col);
this.type = Type.NORMAL;
}

public void updateCoordinates(int x, int y) {
this.x = x;
this.y = y;
public void setLocation(Location location) {
this.location = location;
}

public Color opposite() {
Expand All @@ -24,12 +21,8 @@ public Color opposite() {
return null;
}

public int getX() {
return this.x;
}

public int getY() {
return this.y;
public Location getLocation() {
return location;
}

public void promote() {
Expand Down

0 comments on commit 1c1906d

Please sign in to comment.