import Piece; /** * A class Board to store, delete and move pieces on it. * * @March 2000 * @author Ming Gu, Yasir Mehboob, Ammar Bandukwala. Mustally Hussain, * Shiva Kabra. */ public interface Board { // +--------+----------------------------------------------- // | Fields | // +--------+ /** * Create field: protected Piece[][] pieces. * In this field each piece is put into its own position * according to its row number and column number. For * example: a Piece(a, b) on a n*n board should be the * pieces[a][b] in the array. * REMEMBER!!! The row and column numbers start from (1, 1). */ // +--------------+----------------------------------------- // | Constructors | // +--------------+ /** * Create a Board with parameters: int rownumber, int columnnumber. * The fields should be: int[rownumber+1][columnnumber+1]. */ // +------------+------------------------------------------- // | Extractors | // +------------+ /** * Look up the board and get the piece according to the * parameters' row and column number. The two numbers * of the parameters should exist on the board. If * there is not a piece at this position, a null piece * will be received or an error will be thrown out. * After this method is called, there shouldn't be any * changes made to the board. Only a copy of the * corresponding piece is received. */ public Piece lookupPiece(); /** * Look up a position and see if it is occupied. This method * should take the column number and row number as its * parameters. Return f if the position is null. */ public boolean isOccupied(); // +-----------+-------------------------------------------- // | Modifiers | // +-----------+ /** * Put a piece onto this board's corredponding position. * The method takes a Piece as its parameter, which contains * its position and color. * Be sure that the position of the piece exists on the * board and the corresponding index of the board's * field array or vector is empty or a null piece, an * exception is needed here. After calling this method * a new piece will be put into a specific position on * the board. */ public void putPiece(); /** * Delete a piece at a certain position decided by the * row number and column number parameters. The * position should exist on the board, an exception is * needed here. If there is a piece, delete this piece * from the board. If not, the position remains vacant. * In the field, the position's index place should * be changed to vacant or contain a null piece. * Use this method when you know the position of a piece. */ public void takeoffPiece(); /** * Move a piece decided by the old row and column * number to a new position decided by the new row and * column number. Some precondition is needed: 1)The * old and new positions exist on the board. 2)There * is a piece at the old position. 3)The new position * should be empty or a null piece. An exception is * needed here. After this method is called, the old * position should be empty and its piece is moved into * the new position. Some corresponding changes will * happen to this object's field's index. */ public void movePiece(); /** * Update a certain piece. That is to change the * oldpiece's data to the newpiece's data. Two parameters * are: Piece oldpiece, Piece newpiece. * Be sure that the oldpiece exist on the board and the * newpiece's position is vacant. An exception is needed. */ public void updatePiece(); }// class Board