import Board; import Position; /** * A class Piece to store and change its information. * * @March 2000 * @author Ming Gu, Yasir Mehboob, Ammar Bandukwala, Mustally Hussain, * Shiva Kabra. */ public interface Piece { // +--------+--------------------------------------------- // | Fields | // +--------+ /** The color of the piece. public String color; The position of the piece. public Position position; The number of times the piece has been flipped. public int flipnumber; The board this piece is on. public Board board; */ // +--------------+----------------------------------------- // | Constructors | // +--------------+ /** * Create a piece with its position, color and Board as its * parameters. */ // +------------+----------------------------------------- // | Extractors | // +------------+ /** * Some other objects may ask a piece for its information, * so some necessary extractors are needed. */ /** Get a piece's row number. */ public int getRow(); /** Get a piece's column number. */ public int getColumn(); /** Get a piece's color. */ public String getColor(); /** Get the piece's flip number. */ public int getFlip(); // +---------+-------------------------------------------- // | Methods | // +---------+ /** * Move a piece, with nothing changed but its position. * Update the piece's own position field. * Call board.movePiece(this.rownumber, * this.columnnumber, * newrownumber, * newcolumnnumber) * to update its index on board. */ public void pieceMove (); /** * Flip to a different color and update its flipnumber * by adding 1. */ public void flip(); } // interface Piece