Archive‎ > ‎Fall 2009‎ > ‎Course Project‎ > ‎Buddy Suite‎ > ‎Milestone 3: Chess Game Logic‎ > ‎

ChessGameTestInterface

This is the interface your chess engine will have to implement.


ChessGameTestInterface

package epfl.sweng.chessgame.test;

import java.util.List;

/**
* <p>
* <code>ChessGameTestInterface</code> is a testing interface for the chess
* game.
* </p>
*
* @author Laurent Bindschaedler
*/
public interface ChessGameTestInterface {

/**
* Tries the perform the move described by the parameters.
*
* @param move
* the <code>Move</code> to perform.
* @return the <code>GameState</code> object representing the state of the
* game <b>AFTER</b> the move was performed.
* @throws InvalidMoveException
* if the move is invalid.
* @throws NotYourMoveException
* if it is not the player's turn to move.
*/
public GameState move(Move move) throws InvalidMoveException,
NotYourMoveException;

/**
* @return the state of the game.
*/
public GameState gameState();

/**
* @return the color of the player whose turn it is to play.
*/
public Piece.PieceColor turn();

/**
* @return the outcome of the game.
*/
public GameOutcome outcome();

/**
* Returns the piece at the specified position or Piece.NOPIECE if no piece
* is at that position
*
* @param algebraicPosition
* the position we are interested in
* @return the piece located at the given position
*/
public Piece pieceAtPosition(String algebraicPosition);

/**
* Returns a list of all the allowed moves of the piece at the given
* position. Returns an empty list if there are no allowed moves. Returns
* null if no piece is at that position.
*
* @param position
* the <code>Position</code> of the piece whose moves we're
* interested in
* @return a (possibly empty) list of <b>ALL</b> the allowed moves or null
* if there is no piece at that position.
*/
public List<Move> allowedMoves(Position position);

}

You can find the ChessGameTestInterface related classes and JUnit tests here.

Note: The tests at this location are not exhaustive.

Note: The tests use a ChessGameTestInterfaceFactory factory class to get an implementation of the ChessGameTestInterface. You will have to override the getTestInterface method to return your own implementation of the test interface.

Note: The chess engine is assumed not to be tied to the UI. This is the reason for using simple JUnit tests.