// Overview: The class represents a piece on the checkers board. // The attributes include the identifier, the current position of // the piece, the player who it belongs to, any enhancement // attributed to the piece, e.g., whether the piece has become a // 'king'. public class Piece{ // Attributes private int player; // Whether it's RED or BLACK private int pieceID; // An Identifier private int curPosRow; // Current position of the piece private int curPosCol; private int color; // 0: Empty 1: RED 2:RED_KING 3:BLACK 4:BLACK_KING // Methods // Constructor:Just set the values of the instance variables. Piece(int ID,int r,int c,int type,int p){ pieceID=ID; curPosRow=r; curPosCol=c; color=type; player=p; } //end Piece() // Accessors // Get the ID public int getpieceID(){ return pieceID; } // end getPieceID() // Get the row public int getRowPos(){ return curPosRow; } // end curRowPos() // Get the column public int getColPos(){ return curPosCol; } // end getColPos() // Get the color public int getColor(){ return color; } // end getColor() // Which player is playing the piece public int getPlayer(){ return player; } // end getPlayer() }