Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CSE-4705-Checkers/src/model/Piece.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
36 lines (29 sloc)
514 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model; | |
public class Piece { | |
public final Color color; | |
private int x; | |
private int y; | |
private Type type; | |
public Piece(Color color, int x, int y) { | |
this.color = color; | |
this.x = x; | |
this.y = y; | |
this.type = Type.NORMAL; | |
} | |
public void updateCoordinates(int x, int y) { | |
this.x = x; | |
this.y = y; | |
} | |
public int getX() { | |
return this.x; | |
} | |
public int getY() { | |
return this.y; | |
} | |
public void promote() { | |
this.type = Type.KING; | |
} | |
public Type getType() { | |
return this.type; | |
} | |
} |