Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package chess;
- //This class is partially implemented
- public class Square {
- private int i;
- private int j;
- private boolean hasPiece;
- private Piece p;
- public Square(int iIn, int jIn){
- i=iIn;
- j=jIn;
- }
- public Piece getPiece(){
- return p;
- }
- public void setPiece(Piece p){
- this.p = p;
- p.updateCoordinates(i, j);
- }
- public void removePiece(){
- this.p = null;
- hasPiece = false;
- }
- public boolean hasPiece(){
- if (p == null){
- return false;
- }
- else{
- return true;
- }
- }
- public int getI(){
- return i;
- }
- public int getJ(){
- return j;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement